Exemple #1
0
function fz_exception_handler(Exception $e)
{
    fz_log($e, FZ_LOG_ERROR);
    return error_handler_dispatcher(SERVER_ERROR, $e->getMessage(), $e->getFile(), $e->getLine());
}
Exemple #2
0
/**
 * Raise an error, passing a given error number and an optional message,
 * then exit.
 * Error number should be a HTTP status code or a php user error (E_USER...)
 * $errno and $msg arguments can be passsed in any order
 * If no arguments are passed, default $errno is SERVER_ERROR (500)
 *
 * @param int,string $errno Error number or message string
 * @param string,string $msg Message string or error number
 * @param mixed $debug_args extra data provided for debugging
 * @return void
 */
function halt($errno = SERVER_ERROR, $msg = '', $debug_args = null)
{
    $args = func_get_args();
    $error = array_shift($args);
    # switch $errno and $msg args
    # TODO cleanup / refactoring
    if (is_string($errno)) {
        $msg = $errno;
        $oldmsg = array_shift($args);
        $errno = empty($oldmsg) ? SERVER_ERROR : $oldmsg;
    } else {
        if (!empty($args)) {
            $msg = array_shift($args);
        }
    }
    if (empty($msg) && $errno == NOT_FOUND) {
        $msg = request_uri();
    }
    if (empty($msg)) {
        $msg = "";
    }
    if (!empty($args)) {
        $debug_args = $args;
    }
    set('_lim_err_debug_args', $debug_args);
    error_handler_dispatcher($errno, $msg, null, null);
}