develooper Front page | perl.perl5.porters | Postings from July 2013

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
From:
David E. Wheeler
Date:
July 23, 2013 21:17
Subject:
Re: Try/Catch Exception Objects: Possible?
Message ID:
50FD49DC-E6E0-4CD1-BB87-FD5737A40411@kineticode.com
On Jul 23, 2013, at 11:11 PM, Rafael Garcia-Suarez <rgs@consttype.org> wrote:

>> One thing I've always liked about Try::Tiny et.al. is that
>> they don't get involved in working out how 'catch' dispatch should work.
> 
> Having exceptions as objects can be very useful for testing where they
> come from, or what type of error has occurred. If a new try/catch
> syntax doesn't make this a bit easier than a bare ->isa or ->can call,
> then what is it good for?

More reliable and clearer than `(if my $err = $@)`, and without the scoping problems (return) of Try::Tiny.

Best,

David
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About