Skip to content

Synchronous errors in runZoned should be passed to handleUncaughtErrors #19566

@nex3

Description

@nex3

Consider the following code:

    main() {
      runZoned(() {
        throw 'error 1';
      }, onError: (error, stack) {
        print("Caught $error");
      });

      runZoned(() {
        throw 'error 2';
      }, zoneSpecification: new ZoneSpecification(
          handleUncaughtError: (self, parent, zone, error, stackTrace) {
        print("Caught $error");
      }));
    }

The first [runZoned] prints "Caught error 1", as expected. The second, however, top-levels the error. I'd expect it to behave like [onError] and pass synchronous errors to [handleUncaughtError].

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.closed-not-plannedClosed as we don't intend to take action on the reported issuelibrary-async

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions