mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-24 03:57:27 +08:00
refactor: 规范Expection处理
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class ApiException extends Exception
|
||||
{
|
||||
protected $code; // 错误码
|
||||
protected $message; // 错误消息
|
||||
protected $errors; // 全部错误信息
|
||||
|
||||
public function __construct($code = 400, $message = null, $errors = null)
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->code = $code;
|
||||
$this->errors = $errors;
|
||||
}
|
||||
public function errors(){
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user