Skip to content

finally { } block is not always called #7

@pali

Description

@pali

When doing jump from try { } or catch { } block outside of block then finally is not called.

Example 1:

use Try::Catch;
for (1) {
  try {
    last;
  } catch {
  } finally {
    print "finally was called\n";
  }
}

Example 2:

use Try::Catch;
for (1) {
  try {
    die;
  } catch {
    goto skip;
  } finally {
    print "finally was called\n";
  }
} 
skip:

finally was called is never printed even it was specified in finally { } block which should be always called.

When both examples are used with Try::Tiny instead Try::Catch then examples correctly print finally was called.

This makes finally { } block with Try::Catch totally unusable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions