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

some on_error are not called when one of them throws #380

Closed
tethal opened this issue Jan 8, 2016 · 1 comment
Closed

some on_error are not called when one of them throws #380

tethal opened this issue Jan 8, 2016 · 1 comment
Milestone

Comments

@tethal
Copy link
Contributor

tethal commented Jan 8, 2016

In the following example, cleanup1() does not get called.

%new-style
%enable-all-warnings
%require-types
%strict-args

sub cleanup1() {
    printf("cleanup1\n");
}

sub cleanup2() {
    printf("cleanup2\n");
    throw "unexpected";
}

on_error cleanup1();
on_error cleanup2();

throw "error";

But it works if the on_error statements are in different scopes:

on_error cleanup1();
{
   on_error cleanup2();
   throw "error";
}
@davidnich davidnich added the bug label Jan 14, 2016
@davidnich
Copy link
Contributor

another example:

sub cleanup() { printf("cleanup\n"); }
on_exit cleanup();
on_exit throw True;

the cleanup() call is never executed although it should be

davidnich added a commit that referenced this issue Jan 25, 2016
…d even if an exception is raised in another queued on_* block, added tests + relnotes
tethal added a commit that referenced this issue Jan 26, 2016
refs #380 ensure that all on_exit and on_error statements are execute…
@tethal tethal added the fixed label Jan 26, 2016
@tethal tethal closed this as completed Jan 26, 2016
@davidnich davidnich added this to the 0.8.12 milestone Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants