Skip to content

Suggestion: always run serve_requests in runZoneGuarded #202

@annagrin

Description

@annagrin

serveRequests does not always wrap listening to http requests in a runZoneGuarded wrap:

catchTopLevelErrors(() {

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions