Laravel ->Exceptions ->ApiException 自定义错误异常的封装
原创
©著作权归作者所有:来自51CTO博客作者mp624183768的原创作品,请联系作者获取转载授权,否则将追究法律责任
<?php
/**
* @Description
* @Date 2021-12-21 05:24
*/
namespace Modules\Common\Exceptions;
use Exception;
use Throwable;
class ApiException extends Exception
{
public function __construct($message = "", $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
// public function __construct(array $error_array, Throwable $previous = null)
// {
// parent::__construct($error_array['message'], $error_array['code'], $previous);
// }
}
throw new ApiException("服务器错误", 5000);