LipmError - a class to interface Error classe developped in the lipm
# how to throw LipmError use LipmError;
foo() or throw LipmError( -text => $msg [, -debug => $dbg_msg ] );
#how to catch LipmError use Error qw( :try ); # mandatory ! use LipmError;
try{ DangerousCode(); } catch LipmError with { my ( $err, $r ) = @_; print STDOUT $err->Explain(); # print $msg in a "Lipm" format print STDERR $err->Explain(1); # like above but can add information usefull for debugging. } otherwise { my ( $err, $r ) = @_;
print STDERR $err->text(); } ; # do not forget it !
This class can be used to generate error but it is better to use one of its daugther. It centralized what is common with all Error class developped in the lipm. It declare our global error code and some common methods like how to print where the error is located.
GetMsg IsFatal Explain
Sebastien Letort : sebastien.letort@toulouse.inra.fr
Title : IsFatal Usage : my $bool = $err->IsFatal() Prerequiste: Fatal code are odd code value Function : tell if the program must stop Returns : a boolean, 1 if value is FATAL Args : none Error : none Globals : none
TODO : use this beautifull &FATAL ;)
Title : GetMsg Usage : my $msg = $err->GetMsg() Prerequiste: none Function : give a formatted msg containing where the error occurred Returns : a string Args : none Error : none Globals : none
Title : GetDebug Usage : $dbg_msg = $o_err->GetDebug(); Prerequisite : none Function : accessor for -debug attribute Returns : $dbg_msg, a string, the -debug value it returns undef if no -debug attribute was set. Args : none Globals : none
Title : Explain Usage : my $string = $err->Explain( $verbose ) Prerequiste: none Function : explain the error in details, give information for debugging if $verbose = 1 Returns : a string, the error msg Args : $verbose, a boolean, true if you want information for debugging Error : none Globals : none