On Fri, 2007-12-14 at 20:10 +0300, Dmitriy S. Sinyavskiy wrote > > > Ok it looks good. I have another question - can I detect error by type > for example, > > I need custom error handling only for database error.
Yes, you can die with a ref and then $@ becomes that ref:
eval {
my $some_ref = <your exception class>->new;
die $some_ref;
};
if(blessed $@ && [EMAIL PROTECTED]>isa('<your exception class>'){
# handle whatever
}
elsif ...
Catalyst has Catalyst::Exception and DBIx::Class uses
DBIx::Class::Exception for its errors.
There are a number of CPAN modules that can make this sort of exception
handling easier. Error is one of them, but I don't know what's
recommended these days.
Regards,
Jonathan Rockway
signature.asc
Description: This is a digitally signed message part
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
