Skip to content

Commit 6935215

Browse files
committed
异常处理 有助于开发调试
1 parent b4cb6c2 commit 6935215

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* 应用管理
4+
* @since 2019-10-02
5+
* @author 何秀钢 <bstdn@126.com>
6+
*/
7+
8+
namespace app\util;
9+
10+
use Exception;
11+
use think\exception\Handle;
12+
13+
/**
14+
* Class ExceptionHandle
15+
* @package app\util
16+
* 异常处理handle类
17+
* Detail see: https://www.kancloud.cn/manual/thinkphp5_1/354092
18+
*/
19+
class ExceptionHandle extends Handle {
20+
21+
public function render(Exception $e) {
22+
return parent::render($e)->header(config('apiadmin.CROSS_DOMAIN'));
23+
}
24+
}

config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,6 @@
141141
// 显示错误信息
142142
'show_error_msg' => false,
143143
// 异常处理handle类 留空使用 \think\exception\Handle
144-
'exception_handle' => '',
144+
'exception_handle' => '\\app\\util\\ExceptionHandle',
145145

146146
];

0 commit comments

Comments
 (0)