-
Notifications
You must be signed in to change notification settings - Fork 129
Description
serveRequests
does not always wrap listening to http requests in a runZoneGuarded
wrap:
Line 73 in 6e38575
catchTopLevelErrors(() { |
Line 16 in 6e38575
void catchTopLevelErrors(void Function() callback, |
This leads to hard to debug async exceptions later if something up its call chain adds its own runZoneGuarded
wrapper - in that case exceptions stop being caught and ignored inside serveRequests
and fall to the next root zone exception handler, which unexpectedly changes to logic of the calling code. Note that adding such top level handler will change behavior of all serveRequests
calls, including the ones coming from imported libraries, which makes fixing those new issues particularly complicated.
Can we always run code inside serveRequests
in a runZoneGuarded
, and provide it with an error handler instead for the cases where error behavior needs to be controlled by the user?