function PEAR::raiseError in Flickr API 5
This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. If the $mode and $options parameters are not specified, the object's defaults are used.
@access public
@since PHP 4.0.5
Parameters
mixed $message a text error message or a PEAR error object:
int $code a numeric error code (it is up to your class: to define these if you want to use codes)
int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,: PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter: specifies the PHP-internal error level (one of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). If $mode is PEAR_ERROR_CALLBACK, this parameter specifies the callback function or method. In other error modes this parameter is ignored.
string $userinfo If you need to pass along for example debug: information, this parameter is meant for that.
string $error_class The returned error object will be: instantiated from this class, if specified.
bool $skipmsg If true, raiseError will only pass error codes,: the error message parameter will be dropped.
Return value
object a PEAR error object
See also
PEAR::setErrorHandling
30 calls to PEAR::raiseError()
- DB::connect in phpFlickr/
PEAR/ DB.php - Create a new DB object including a connection to the specified database
- DB::factory in phpFlickr/
PEAR/ DB.php - Create a new DB object for the specified database type but don't connect to the database
- DB_common::raiseError in phpFlickr/
PEAR/ DB/ common.php - Communicates an error and invoke error callbacks, etc
- DB_storage::remove in phpFlickr/
PEAR/ DB/ storage.php - Remove the row represented by this object from the database.
- DB_storage::set in phpFlickr/
PEAR/ DB/ storage.php - Modify an attriute value.
1 method overrides PEAR::raiseError()
- DB_common::raiseError in phpFlickr/
PEAR/ DB/ common.php - Communicates an error and invoke error callbacks, etc
File
- phpFlickr/
PEAR/ PEAR.php, line 523
Class
- PEAR
- Base class for other PEAR classes. Provides rudimentary emulation of destructors.
Code
function &raiseError($message = null, $code = null, $mode = null, $options = null, $userinfo = null, $error_class = null, $skipmsg = false) {
// The error is yet a PEAR error object
if (is_object($message)) {
$code = $message
->getCode();
$userinfo = $message
->getUserInfo();
$error_class = $message
->getType();
$message->error_message_prefix = '';
$message = $message
->getMessage();
}
if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
if ($exp[0] == "*" || is_int(reset($exp)) && in_array($code, $exp) || is_string(reset($exp)) && in_array($message, $exp)) {
$mode = PEAR_ERROR_RETURN;
}
}
// No mode given, try global ones
if ($mode === null) {
// Class error handler
if (isset($this) && isset($this->_default_error_mode)) {
$mode = $this->_default_error_mode;
$options = $this->_default_error_options;
// Global error handler
}
elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
$mode = $GLOBALS['_PEAR_default_error_mode'];
$options = $GLOBALS['_PEAR_default_error_options'];
}
}
if ($error_class !== null) {
$ec = $error_class;
}
elseif (isset($this) && isset($this->_error_class)) {
$ec = $this->_error_class;
}
else {
$ec = 'PEAR_Error';
}
if ($skipmsg) {
$a =& new $ec($code, $mode, $options, $userinfo);
return $a;
}
else {
$a =& new $ec($message, $code, $mode, $options, $userinfo);
return $a;
}
}