Files
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

31 lines
648 B
PHP

<?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');
}
}