Ambrosia::error::Exception - an unspecified exception. Ambrosia::error::Exception::BadUsage - this exception will occur if you use something incorrect. Ambrosia::error::Exception::BadParams - this exception will occur if you use incorrect parameters. Ambrosia::error::Exception::AccessDenied - this exception will occur if you try run closed method.
use Ambrosia::error::Exceptions; sub test { unless ( @_ ) { throw Ambrosia::error::Exception::BadParams("Must call test with arguments."); } } eval { test(); }; if ( $@ ) { if ( ref $@ && $@->isa('Ambrosia::error::Exception::Error') ) { print "ERROR: " . $@->message . "\n"; print "STACK:\n" . $@->stack . "\n"; print "CODE: " . $@->code . "\n"; #printed: #ERROR: Must call test with arguments. #ERROR: Must call test with arguments. #STACK: # Ambrosia::error::Exception::BadParams::throw( Ambrosia::error::Exception::BadParams, Must call test with arguments. ) at main line ... # main::test( ) at main line ... # (eval) at main line ... #CODE: E0002 #ERROR: Must call test with arguments. #STACK: # Ambrosia::error::Exception::BadParams::throw( Ambrosia::error::Exception::BadParams, Must call test with arguments. ) at main line ... # main::test( ) at main line ... # (eval) at main line ... } #or you can do so: print "ERROR: $@"; #printed: #ERROR: Must call test with arguments. # Ambrosia::error::Exception::BadParams::throw( Ambrosia::error::Exception::BadParams, Must call test with arguments. ) at main line ... # main::test( ) at main line ... # (eval) at main line ... }
List of different types of exceptions. Ambrosia::error::Exception - an unspecified exception. Ambrosia::error::Exception::BadUsage - this exception will occur if you use something incorrect. Ambrosia::error::Exception::BadParams - this exception will occur if you use incorrect parameters. Ambrosia::error::Exception::AccessDenied - this exception will occur if you try run closed method.
System exception of undefined type.
Incorrect use of the method of the class.
Bad parameters.
Trying to use a private field or method.
Not tested.
Please report bugs relevant to Ambrosia to <knm[at]cpan.org>.
Ambrosia
Copyright (C) 2010-2012 Nickolay Kuritsyn. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Nikolay Kuritsyn (knm[at]cpan.org)
To install Ambrosia, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ambrosia
CPAN shell
perl -MCPAN -e shell install Ambrosia
For more information on module installation, please visit the detailed CPAN module installation guide.