Handling for internal server errors#246
Conversation
|
Test FAILed. |
dcrankshaw
left a comment
There was a problem hiding this comment.
Why are you rethrowing the exceptions inside a try block?
| prediction.then([response, app_metrics](boost::future<Response> f) { | ||
| if (f.has_exception()) { | ||
| try { | ||
| boost::rethrow_exception(f.get_exception_ptr()); |
There was a problem hiding this comment.
Why are we re-throwing the exception here? This will immediately be caught by the catch statement right?
There was a problem hiding this comment.
Yes. If the boost future encounters a fatal exception, it will store it in an exception pointer tied to the future. rethrow_exception allows us to obtain the original exception that was thrown and log / handle it appropriately. This flow is a documented way of performing exception propagation when using boost futures / threads.
|
Does this fix #245? |
|
@dcrankshaw This fixes the |
|
Sounds good. I figured you got that from somewhere, just wanted to double check. I'll merge once the tests pass. |
|
Test PASSed. |
If the thread of execution responsible for delivering an HTTP prediction response encounters an unexpected error, this PR ensures that we respond with error code 500 instead of timing out.