{"action":"opened","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/24052","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/24052/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/24052/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/24052/events","html_url":"https://github.com/dart-lang/sdk/issues/24052","id":100492309,"number":24052,"title":"Error repeated on stder although isolate has error listener installed","user":{"login":"peter-ahe-google","id":5689005,"avatar_url":"https://avatars.githubusercontent.com/u/5689005?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-ahe-google","html_url":"https://github.com/peter-ahe-google","followers_url":"https://api.github.com/users/peter-ahe-google/followers","following_url":"https://api.github.com/users/peter-ahe-google/following{/other_user}","gists_url":"https://api.github.com/users/peter-ahe-google/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-ahe-google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-ahe-google/subscriptions","organizations_url":"https://api.github.com/users/peter-ahe-google/orgs","repos_url":"https://api.github.com/users/peter-ahe-google/repos","events_url":"https://api.github.com/users/peter-ahe-google/events{/privacy}","received_events_url":"https://api.github.com/users/peter-ahe-google/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-12T08:23:58Z","updated_at":"2015-08-12T08:23:58Z","closed_at":null,"body":"Consider the program below. When run with -DareErrorsFatal=true, this message is printed on stderr:\r\n\r\n```\r\nin ShutdownIsolate: 'file:///.../isolate.dart': error: line 42 pos 7: type name expected\r\n  new new();\r\n      ^\r\n\r\n```\r\n\r\nAs I have installed an error handler on the isolate, I expect no message is printed.\r\n\r\nThese messages are confusing when running tests that are expected to fail, as these additional error messages may lead people to investigate the wrong problem.\r\n\r\nThe work around I have found so far is to not set errors to fatal. Unfortunately, this means that a broken program may continue and potentially cause real harm as invariants may be broken.\r\n\r\n```\r\nimport 'dart:isolate';\r\n\r\nconst bool areErrorsFatal = const bool.fromEnvironment(\"areErrorsFatal\");\r\n\r\nmain() async {\r\n  Isolate isolate;\r\n  ReceivePort exitPort = new ReceivePort();\r\n  ReceivePort errorPort = new ReceivePort();\r\n\r\n  exitPort.listen((_) {\r\n    print(\"Isolate exited\");\r\n    exitPort.close();\r\n    errorPort.close();\r\n  });\r\n\r\n  errorPort.listen((List message) {\r\n    var error = message[0];\r\n    var stackTrace = message[1];\r\n    print(\"Error in isolate: $error\");\r\n    if (stackTrace != null) {\r\n      print(stackTrace);\r\n    }\r\n    if (!areErrorsFatal) {\r\n      print(\"Killing isolate\");\r\n      isolate.kill();\r\n    }\r\n  });\r\n\r\n  isolate = await Isolate.spawn(entryPoint, null, paused: true);\r\n\r\n  isolate.setErrorsFatal(areErrorsFatal);\r\n  isolate.addOnExitListener(exitPort.sendPort);\r\n  isolate.addErrorListener(errorPort.sendPort);\r\n  ReceivePort ping = new ReceivePort();\r\n  isolate.ping(ping.sendPort);\r\n  await ping.first;\r\n\r\n  isolate.resume(isolate.pauseCapability);\r\n}\r\n\r\nentryPoint(_) {\r\n  new new();\r\n}\r\n```\r\n\r\n"}}