mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-01-03 12:37:02 -06:00
improve error handling
This commit is contained in:
parent
acfe9889d2
commit
cd86ea756d
@ -7,6 +7,11 @@ public class InvalidStatusCodeException extends RuntimeException {
|
||||
private final Pattern ok_status;
|
||||
private final int statusCode;
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Server returned status code '" + statusCode + "' which did not match ok_status '" + ok_status.toString() + "'";
|
||||
}
|
||||
|
||||
public InvalidStatusCodeException(long cycleValue, Pattern ok_status, int statusCode) {
|
||||
this.cycleValue = cycleValue;
|
||||
this.ok_status = ok_status;
|
||||
|
@ -13,9 +13,6 @@ public class StopErrorHandler implements ErrorHandler {
|
||||
|
||||
@Override
|
||||
public ErrorDetail handleError(Throwable t, long cycle, long durationInNanos, ErrorDetail detail) {
|
||||
String durationSummary = String.format("%.3fS", ((double) durationInNanos / 1000000000.0));
|
||||
throw new RuntimeException(
|
||||
"An error was rethrown in order to stop the activity in cycle:" + cycle + ", duration:" + durationSummary + " msg:" +
|
||||
t.getMessage());
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user