Skip Menu |
 

This queue is for tickets about the TryCatch CPAN distribution.

Report information
The Basics
Id: 49072
Status: open
Priority: 0/
Queue: TryCatch

People
Owner: Nobody in particular
Requestors: CRAKRJACK [...] cpan.org
Cc: SMYLERS [...] cpan.fsck.com
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.001001
Fixed in: 1.001001



Subject: TryCatch forces you to capture your exception in a variable
Download (untitled) / with headers
text/plain 314b
eg; this doesn't work: try { ... } catch (MyApp::Exception::CantLock) { $log->error("Can't lock output, skipped."); next OUTPUT; } instead, I have to: try { ... } catch (MyApp::Exception::CantLock $e) { $log->error("Can't lock output, skipped."); next OUTPUT; } ... even though I dont care about '$e'.
Download (untitled) / with headers
text/plain 484b
On Thu Aug 27 16:11:57 2009, CRAKRJACK wrote: Show quoted text
> eg; this doesn't work: > > try { ... } > catch (MyApp::Exception::CantLock) { > $log->error("Can't lock output, skipped."); > next OUTPUT; > } > > instead, I have to: > > try { ... } > catch (MyApp::Exception::CantLock $e) { > $log->error("Can't lock output, skipped."); > next OUTPUT; > } > > ... even though I dont care about '$e'.
Hmm yeah that is a bit fail. Working on this. Expect a new version soon (within a week)
Download (untitled) / with headers
text/plain 637b
On Mon Sep 07 17:47:01 2009, ASH wrote: Show quoted text
> On Thu Aug 27 16:11:57 2009, CRAKRJACK wrote:
> > eg; this doesn't work: > > > > try { ... } > > catch (MyApp::Exception::CantLock) { > > $log->error("Can't lock output, skipped."); > > next OUTPUT; > > } > > > > instead, I have to: > > > > try { ... } > > catch (MyApp::Exception::CantLock $e) { > > $log->error("Can't lock output, skipped."); > > next OUTPUT; > > } > > > > ... even though I dont care about '$e'.
> > > Hmm yeah that is a bit fail. Working on this. Expect a new version soon > (within a week)
Hi... it's been a year now and this is still broken. Any update? :)
Download (untitled) / with headers
text/plain 151b
I'm sorry I completely forgot about this bug. Could you try upgrading Parse::Method::Signatures and TryCatch and double check this is still the case?
Subject: Re: [rt.cpan.org #49072] TryCatch forces you to capture your exception in a variable
Date: Sat, 15 Jan 2011 23:29:38 -0800
To: bug-TryCatch [...] rt.cpan.org
From: Tyler MacDonald <tyler [...] macdonald.name>
Download (untitled) / with headers
text/plain 675b
Unfortunately, this is still a bug. :-( The following script renders an error, whereas if I add a "$e" in the catch(), everything is fine. { package ContrivedException; use Moose; has 'message' => (is => 'rw'); } use TryCatch; try { die ContrivedException->new(message => "yay"); } catch(ContrivedException) { print "We're good!\n"; } This is the actual error: Error parsing parameter near 'ContrivedException' in 'ContrivedException' at test.pl line 13 syntax error at test.pl line 13, near "} {" Missing right curly or square bracket at test.pl line 16, at end of line Execution of test.pl aborted due to compilation errors.
Download (untitled) / with headers
text/plain 434b
I have much the same problem, being forced to capture the error in a lexical: the default use of try/catch putting the error into $@ doesn't work. E.g. The following script outputs "Error: " instead of "Error: Oops": use TryCatch; try { die "Oops\n" } catch { print "Error: $@"; exit } print "OK\n"; If I use "catch ($err) { ... }" and print out "Error: $err" instead then all is well. Is this issue going to be addressed sometime?
Download (untitled) / with headers
text/plain 168b
Ash, Could you give me co-maint, and ideally push permission on https://github.com/ashb/trycatch as well? I'd like to fix this and especially the ". in @INC" problem.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.