Commit 3c108200 by feixiang

异常类统一系统异常及用户异常返回数据形式

parent 858f970c
......@@ -40,14 +40,18 @@ class ExceptionData
if ( is_callable([$e,"getPath"]) ) {//自建异常类处理path
$data['path'] = json_decode($e->getPath(), true);
//获取调用堆栈信息
$info = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,1)[0];
//将此次异常信息入站
array_unshift($data['path'],'Service:'.APP_NAME.' file:'.$info['file'].'('.$info['line'].')');
} else { //系统异常统一报500错误
$data['code'] = 500;
//将此次异常信息入站
array_unshift($data['path'],'Service:'.APP_NAME.' file:'.$e->getFile().'('.$e->getLine().')');
}
//获取调用堆栈信息
$info = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,1)[0];
//将此次异常信息入站
array_unshift($data['path'],'Service:'.APP_NAME.' file:'.$info['file'].'('.$info['line'].')');
return ['msg' => json_encode($data), 'code' => $data['code']];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment