Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finally block doesn't handle errors from within catch block #11758

Closed
DartBot opened this issue Jul 9, 2013 · 4 comments
Closed

Finally block doesn't handle errors from within catch block #11758

DartBot opened this issue Jul 9, 2013 · 4 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-duplicate Closed in favor of an existing report

Comments

@DartBot
Copy link

DartBot commented Jul 9, 2013

This issue was originally filed by shailen.tu...@gmail.com


What steps will reproduce the problem?

Type this code in the Editor and run it:

void main() {
  try {
    try {
      throw null;
    } catch(e) {
      throw null;
    } finally {
      print('first');
    }
  } finally {
    print('second');
  }
}

What is the expected output? What do you see instead?

In the VM this produces the following result:

second
Unhandled exception: Throw of null.

In dart2js (try.dartlang.org), it produces this result:

first
second
Uncaught Throw of null.

The two should produce the same output.

The language spec states that:

If an exception is raised during execution of an on-catch clause, this will transfer control to the handler for the finally clause, causing the finally clause to execute in this case as well.

This suggests that the VM implementation has a bug: the error thrown within the catch block does not lead the subsequent finally clause to execute.

What version of the product are you using? On what operating system?

OSX 10.8.4
Dart SDK version 0.5.20.4_r24275

Please provide any additional information below.

This was first reported on StackOverflow:

http://stackoverflow.com/questions/17553334/understanding-exception-handling-mechanism-control-flow-in-dart

@DartBot
Copy link
Author

DartBot commented Jul 9, 2013

This comment was originally written by @mhausner


Kevin, didn't you fix this recently in the VM?


Set owner to @kmillikin.
Added Area-VM, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jul 10, 2013

This comment was originally written by @darshan-


This does appear to be fixed sometime between r24275 and r24868:

$ dart --version
Dart VM version: 0.1.2.0_r24868_darshan (Tue Jul 9 16:55:51 2013) on "linux_x64"

$ dart bug.dart
first
second
Unhandled exception:
Throw of null.

@DartBot
Copy link
Author

DartBot commented Jul 10, 2013

This comment was originally written by @mhausner


Ok, then let me close this issue.


Added Fixed label.

@fsc8000
Copy link
Contributor

fsc8000 commented Jul 10, 2013

Added Duplicate label.
Marked as being merged into #430.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-duplicate Closed in favor of an existing report labels Jul 10, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

4 participants