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

the CATCH block catching its own exception recursively forever #841

Closed
p6rt opened this issue Mar 29, 2009 · 10 comments
Closed

the CATCH block catching its own exception recursively forever #841

p6rt opened this issue Mar 29, 2009 · 10 comments

Comments

@p6rt
Copy link

p6rt commented Mar 29, 2009

Migrated from rt.perl.org#64262 (status was 'resolved')

Searchable as RT64262$

@p6rt
Copy link
Author

p6rt commented Mar 29, 2009

From @ilyabelikin

Hi there,

example​:

try{
  foo;
  CATCH { die 1 }
}

S04, L800​:

A C<CATCH> block sees the lexical scope in which it was defined, but
its caller is the dynamic location that threw the exception. That is,
the stack is not unwound until some exception handler chooses to
unwind it by "handling" the exception in question. So logically,
if the C<CATCH> block throws its own exception, you would expect the
C<CATCH> block to catch its own exception recursively forever. However,
a C<CATCH> must not behave that way, so we say that a C<CATCH> block
never attempts to handle any exception thrown within its own dynamic scope.
(Otherwise the C<die> in the previous paragraph would never work.)

Ilya

@p6rt
Copy link
Author

p6rt commented Jun 30, 2009

From @kyleha

There's now a test for this in S04-statements/try.t​:

{
  my $catches = 0;
  try {
  try {
  die 'catch!';
  CATCH {
  die 'caught' if ! $catches++;
  }
  }
  }
  is $catches, 1, 'CATCH does not catch exceptions thrown within it';
}

@p6rt
Copy link
Author

p6rt commented Jul 11, 2010

From @jnthn

On Tue Jun 30 12​:33​:03 2009, KyleHa wrote​:

There's now a test for this in S04-statements/try.t​:

{
my $catches = 0;
try {
try {
die 'catch!';
CATCH {
die 'caught' if ! $catches++;
}
}
}
is $catches, 1, 'CATCH does not catch exceptions thrown within it';
}

Which Rakudo now passes after a fix. I didn't find the test in the test
file though...oddness. Anyway, added it and it passes. :-) Closing ticket.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Jul 11, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 11, 2010

@jnthn - Status changed from 'open' to 'resolved'

@p6rt
Copy link
Author

p6rt commented Sep 15, 2010

@moritz - Status changed from 'resolved' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 15, 2010

From @moritz

The test fails again (and has been doing that for quite some time, so
I'm reopening the ticket).

@p6rt
Copy link
Author

p6rt commented Sep 9, 2011

From @bbkr

still broken in NOM branch

@p6rt
Copy link
Author

p6rt commented Oct 26, 2011

From @moritz

Finally fixed thanks to mls, tested in catch.t

@p6rt
Copy link
Author

p6rt commented Oct 26, 2011

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Oct 26, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant