24/01
2018
ddv-exception php library
composer require ddvphp/ddv-exception
\DdvPhp\DdvException\Handler::setHandler(function (array $r, $e) { var_dump($r); });
throw new \DdvPhp\DdvException\Error("测试一个异常", 'TEST_A_EXCEPTION');
class UserError extends \DdvPhp\DdvException\Error { // 魔术方法 public function __construct( $message = 'Unknown Error' , $errorId = 'UNKNOWN_ERROR' , $code = '400', $errorData = array() ) { parent::__construct( $message , $errorId , $code, $errorData ); } } throw new UserError("测试一个异常", 'TEST_A_EXCEPTION');