fix(dispatcher): catch validation errors in outbound sendEvent/sendCreate#41869
fix(dispatcher): catch validation errors in outbound sendEvent/sendCreate#41869triemerge wants to merge 1 commit into
sendEvent/sendCreate#41869Conversation
| try { | ||
| const validator = findValidator(type, '', 'Initializer'); | ||
| initializer = validator(initializer, '', this._validatorToWireContext()); | ||
| } catch (e) { |
There was a problem hiding this comment.
this is likely far too broad of a catch-all (i.e. it could mask other legitimate bugs that need fixing)
There was a problem hiding this comment.
Yeah that makes sense, reverted the sendCreate change and also narrowed the remaining sendEvent catch to ValidationError only while at it.
| } catch (e) { | ||
| if (isUnderTest()) | ||
| throw e; | ||
| return; |
There was a problem hiding this comment.
i dont think we can safely just drop this as the object has been created (i.e. a future operation with the same guid will fail)
There was a problem hiding this comment.
Agreed, the dispatcher is already registered at that point so just returning would leave things in a weird state. Would you prefer the sendCreate path handled separately or is it fine to leave that for a follow up?
Edit: for the sendCreate path, one option could be catching in the Dispatcher constructor instead, where we have access to undo the registration. That way there's no ghost object. happy to add that here if it makes sense..
30c3805 to
8ef2d7b
Compare
Rationale
The inbound
dispatch()path catches validator errors, but the outboundsendEvent/sendCreateside doesn't seem to. A validation failure there can go uncaught and take down the driver process.Followed the same
isUnderTest()convention used elsewhere in this file.Fixes #41865