ping-qu/exception

pingqu exception php library

0.0.1 2017-06-15 09:31 UTC

This package is not auto-updated.

Last update: 2024-11-24 04:42:26 UTC


README

Installation - 安装

composer require ping-qu/exception

Usage - 使用

1、抛出异常

throw new \Pingqu\Exception\Error("测试一个异常", 'TEST_A_EXCEPTION');

2、抛出自定义继承异常

class UserError extends \Pingqu\Exception\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');