/** * A method to invoke errors. * * @static * @param mixed $message A string error message, or a {@link PEAR_Error} object. * @param integer $type A custom message code - see the {@link setupConstants()} function. * @param integer $behaviour Optional behaviour (i.e. PEAR_ERROR_DIE to halt on this error). * @return PEAR_Error $error A (@link PEAR_Error} object. */ function raiseError($message, $type = null, $behaviour = null) { // If fatal if ($behaviour == PEAR_ERROR_DIE) { // Log fatal message here as execution will stop $errorType = MAX::errorConstantToString($type); if (!is_string($message)) { $message = print_r($message, true); } OA::debug($type . ' :: ' . $message, PEAR_LOG_EMERG); exit; } $error = PEAR::raiseError($message, $type, $behaviour); return $error; }