Skip to content

Poor error handling in Dartium isolates #10222

Closed
@peter-ahe-google

Description

@peter-ahe-google

Consider this program:

import 'dart:isolate';
import 'dart:html' show HttpRequest;

useHttpRequest() {
  print('In isolate.');
  HttpRequest.getString('test.dart').then((text) => print(text));
}

main() {
  print('Starting isolate');
  spawnFunction(useHttpRequest);
}

All that shows up in the console is:

"Starting isolate undefined:1"

I had expected to see:

"Starting isolate test.dart:10
[From isolate] In isolate. test.dart:5
[From isolate] DOM access is not enabled in this isolate

­0 HttpRequest._create (file:///Volumes/data/b/build/slave/dartium-mac-inc/build/src/out/Release/gen/webkit/bindings/dart/dart/html/HttpRequest.dart:60:3)

­1 HttpRequest.HttpRequest (file:///Volumes/data/b/build/slave/dartium-mac-inc/build/src/out/Release/gen/webkit/bindings/dart/dart/html/HttpRequest.dart:58:35)

­2 HttpRequest.request (file:///Volumes/data/b/build/slave/dartium-mac-inc/build/src/out/Release/gen/webkit/bindings/dart/dart/html/HttpRequest.dart:10:15)

­3 HttpRequest.getString (file:///Volumes/data/b/build/slave/dartium-mac-inc/build/src/out/Release/gen/webkit/bindings/dart/dart/html/HttpRequest.dart:5:19)

­4 useHttpRequest (http://127.0.0.1:56653/web_editor/test.dart:6:26)

This is almost what happens if I modify useHttpRequest:

useHttpRequest() {
  print('In isolate.');
  try {
    HttpRequest.getString('test.dart').then((text) => print(text));
  } catch (e, trace) {
    print('$e\n$trace');
  }
}

So the following questions arise:

  1. Why isn't the the text "In isolate" printed in the console?
  2. Why isn't the uncaught exception diagnosed?
  3. Why doesn't the debugger pause on the exception?
  4. Why does the console say "undefined:1"?

I'll file a separate bug about HttpRequest not being available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work ontype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions