Skip to content

Commit a5e52a6

Browse files
author
Matt Jacobs
committed
Call hook.onError in HystrixBadRequestException flow
1 parent cec25ed commit a5e52a6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java

+11
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,17 @@ private R executeCommand() {
13061306
logger.warn("Error calling ExecutionHook.onRunError", hookException);
13071307
}
13081308

1309+
try {
1310+
Exception decorated = executionHook.onError(this, FailureType.BAD_REQUEST_EXCEPTION, e);
1311+
if (decorated instanceof HystrixBadRequestException) {
1312+
e = (HystrixBadRequestException) decorated;
1313+
} else {
1314+
logger.warn("ExecutionHook.onError returned an exception that was not an instance of HystrixBadRequestException so will be ignored.", decorated);
1315+
}
1316+
} catch (Exception hookException) {
1317+
logger.warn("Error calling ExecutionHook.onError", hookException);
1318+
}
1319+
13091320
/*
13101321
* HystrixBadRequestException is treated differently and allowed to propagate without any stats tracking or fallback logic
13111322
*/

0 commit comments

Comments
 (0)