mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-01-05 21:43:06 -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 Pattern ok_status;
|
||||||
private final int statusCode;
|
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) {
|
public InvalidStatusCodeException(long cycleValue, Pattern ok_status, int statusCode) {
|
||||||
this.cycleValue = cycleValue;
|
this.cycleValue = cycleValue;
|
||||||
this.ok_status = ok_status;
|
this.ok_status = ok_status;
|
||||||
|
@ -13,9 +13,6 @@ public class StopErrorHandler implements ErrorHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ErrorDetail handleError(Throwable t, long cycle, long durationInNanos, ErrorDetail detail) {
|
public ErrorDetail handleError(Throwable t, long cycle, long durationInNanos, ErrorDetail detail) {
|
||||||
String durationSummary = String.format("%.3fS", ((double) durationInNanos / 1000000000.0));
|
throw new RuntimeException(t);
|
||||||
throw new RuntimeException(
|
|
||||||
"An error was rethrown in order to stop the activity in cycle:" + cycle + ", duration:" + durationSummary + " msg:" +
|
|
||||||
t.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user