LipmError::ParameterException - a class to define specific exception of Parameter
throw LipmError::ParameterException('param', 'missing'); record LipmError::ParameterException('param', 'type', -text => "seul les entiers sont valides pour ce parametre"); new LipmError::ParameterException('param', 'value', -should_be => "without figures"); catch LipmError::ParameterException with {...}
This class deals with Parameters exceptions like 'missing', 'wrong-parameter'. it has built-in messages, all you have to do is to specify which kind of error you have
new Explain
Sebastien Letort : sebastien.letort@toulouse.inra.fr
Title : new Usage : throw LipmError::ParameterException ($param, $keyword [, -should_be => $string, -depth => $depth]) Prerequisite : it's better for an error to be catch ! Function : Constructor Returns : an Error object that should be catched. Args : $param, name of the parameter that cause the Error thrown. $keyword, une clef du hash de message predefini $string, a message explaining what it should be cf Explain(). $depth, to specify how deep the error is thrown. I don't know yet when you have to set it, but (for now) in most cases, just forget it. Globals : none
Title : Explain Usage : $error_msg = $err->Explain($bool); Prerequisite : none Function : provide a short explanation. It's for developement purpose, not user information Returns : a string describing the error Args : $bool, if true, will (try to) explain what must be changed to be correct. Globals : none
Title : Assert Usage : LipmError::ParameterException::Assert( 'var'=>$var, 'name'=>$name ); Prerequisite : static method Procedure : throw a PE error if one of %h_vars values is undef, with the 'missing' keyword Args : %h_vars, keys are variable names and values are variable value Globals : none Error : a ParameterException