Pass through the exception type of several durable object internal errors - #2157
Conversation
2566b84 to
354a88c
Compare
|
(Per internal feedback, updated PR to move |
| #define WD_EXPECT_THROW(expException, code, ...) \ | ||
| do { \ | ||
| auto expExcObj = expException; \ | ||
| KJ_IF_SOME(e, ::kj::runCatchingExceptions([&]() { (void)({ code; }); })) { \ |
There was a problem hiding this comment.
Nit: what about exceptions like jsg::JsExceptionThrown? If those aren't important to capture here, all good... but might be good to specify that in a comment
There was a problem hiding this comment.
Good point... The function does not currently provide special handling for jsg::JsExceptionThrown, and I hadn't been fully aware that those exceptions might need to be handled differently.
However, I think the function as-is is sufficient for a test to ensure that a thrown kj::Exception has the expected type and message, which is what it is currently used for. If a JsExceptionThrown is thrown instead, it would be captured via getCaughtExceptionAsKj() as a kj::Exception of type "failed", with an extra std::exception in the description. So I think it would hard at least for a JsExceptionThrown to accidentally match an expected non-JsExceptionThrown exception.
I've added a comment advising that the macro is intended for matching kj::Exceptions, and that someone who wants to assert on a JS exception should probably use a separate macro.
354a88c to
d900202
Compare
…imeout" ...from "failed" to "overloaded".
...to give a better idea of appropriate retry behavior.
d900202 to
c00e345
Compare
No description provided.