first commit
This commit is contained in:
31
pgserver/application/admin/exception/LogicException.php
Normal file
31
pgserver/application/admin/exception/LogicException.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\exception;
|
||||
|
||||
|
||||
use think\Container;
|
||||
use think\Response;
|
||||
|
||||
class LogicException extends \Exception implements RenderException
|
||||
{
|
||||
|
||||
public $errors;
|
||||
|
||||
public function __construct($msg = '',$code = 500,$errors = [])
|
||||
{
|
||||
parent::__construct($msg,$code);
|
||||
$this->errors = $errors;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$data['code'] = $this->getCode();
|
||||
$data['msg'] = $this->getMessage();
|
||||
$data['data'] = $this->errors;
|
||||
if (Container::get('app')->isDebug()){
|
||||
$data['trace'] = $this->getTrace();
|
||||
}
|
||||
return Response::create($data,'json');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user