Overview

Namespaces

  • None
  • Wei
    • Validator

Classes

  • Apc
  • App
  • ArrayCache
  • Asset
  • Base
  • BaseCache
  • BaseController
  • Bicache
  • Cache
  • Config
  • Cookie
  • Couchbase
  • Counter
  • Db
  • DbCache
  • E
  • Env
  • Error
  • FileCache
  • Gravatar
  • Http
  • Lock
  • Logger
  • Memcache
  • Memcached
  • MongoCache
  • Password
  • PhpError
  • PhpFileCache
  • Pinyin
  • Record
  • Redis
  • Request
  • Response
  • Router
  • SafeUrl
  • Session
  • Soap
  • T
  • Ua
  • Upload
  • Url
  • Uuid
  • Validate
  • View
  • WeChatApp
  • Wei
  • Overview
  • Namespace
  • Class

Class Error

A service that handles exception and display pretty exception message

Wei\Base
Extended by Wei\Error
Namespace: Wei
Located at Error.php
Methods summary
public
# __construct( array $options = array() )

Constructor

Constructor

Parameters

$options

Throws

InvalidArgumentException
When option "wei" is not an instance of "Wei\Wei"

Overrides

Wei\Base::__construct()
public
# __invoke( callable $fn )

Attach a handler to exception error

Attach a handler to exception error

Parameters

$fn
The error handler

Returns


$this
public
# notFound( callable $fn )

Attach a handler to not found error

Attach a handler to not found error

Parameters

$fn
The error handler

Returns


$this
public
# fatal( callable $fn )

Attach a handler to fatal error

Attach a handler to fatal error

Parameters

$fn
The error handler

Returns


$this
protected
# registerExceptionHandler( )

Register exception Handler

Register exception Handler

protected
# registerErrorHandler( )

Register error Handler

Register error Handler

protected
# registerFatalHandler( )

Detect fatal error and register fatal handler

Detect fatal error and register fatal handler

public boolean
# triggerHandler( string $type, Exception $exception )

Trigger a error handler

Trigger a error handler

Parameters

$type
The type of error handlers
$exception

Returns

boolean
public
# handleException( Exception $exception )

The exception handler to render pretty message

The exception handler to render pretty message

Parameters

$exception
public
# internalHandleException( Exception $exception )
public
# renderException( Exception $e, boolean $debug )

Render exception message

Render exception message

Parameters

$e
$debug
Whether show debug trace
public
# handleError( integer $code, string $message, string $file, integer $line )

The error handler convert PHP error to exception

The error handler convert PHP error to exception

Parameters

$code
The level of the error raised
$message
The error message
$file
The filename that the error was raised in
$line
The line number the error was raised at

Throws

ErrorException
convert PHP error to exception
public string
# getFileCode( string $file, integer $line, integer $range = 20 )

Get file code in specified range

Get file code in specified range

Parameters

$file
The file name
$line
The file line
$range
The line range

Returns

string
Methods inherited from Wei\Base
__call(), __get(), getOption(), setOption()
Properties summary
protected string $message

The default error message display when debug is not enable

The default error message display when debug is not enable

# 'Error'
protected string $detail

The detail error message display when debug is not enable

The detail error message display when debug is not enable

# 'Unfortunately, an error occurred. Please try again later.'
protected string $notFoundDetail

The detail error message display when thrown 404 exception

The detail error message display when thrown 404 exception

# 'Sorry, the page you requested was not found. Please check the URL and try again.'
protected boolean $ignorePrevHandler

Whether ignore the previous exception handler or attach it again to the exception event

Whether ignore the previous exception handler or attach it again to the exception event

# false
protected null|callable $prevExceptionHandler

The previous exception handler

The previous exception handler

#
protected array $handlers

The custom error handlers

The custom error handlers

# array( 'error' => array(), 'fatal' => array(), 'notFound' => array() )
Properties inherited from Wei\Base
$providers, $wei
Magic properties summary
public Wei\Logger $logger

The logger wei

public Wei\Response $response

The HTTP response wei

Wei Framework API documentation generated by ApiGen