Jump to content

Exceptions: Difference between revisions

no edit summary
No edit summary
Line 120:
//This code is always executed after exiting the try block
}
 
==[[Perl]]==
[[Category:Perl]]
 
# throw an exception
die "Danger, danger, Will Robinson!";
# catch an exception and show it
eval {
die "this could go wrong mightily";
};
print $@ if $@;
# rethrow
die $@;
See http://perldoc.perl.org/perlvar.html#%24EVAL_ERROR for the meaning of the special variable <tt>$@</tt>. See http://search.cpan.org/dist/Error for an advanced, object based exception handling.
 
==[[Python]]==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.