Commit b0a1b295 by zhufx

解析异常信息

parent a5966701
...@@ -11,14 +11,21 @@ class ExceptionParseData ...@@ -11,14 +11,21 @@ class ExceptionParseData
{ {
public static function parseData(\Exception $e) public static function parseData(\Exception $e)
{ {
$response = $e->getResponse(); if ( is_callable($e,'getResponse') ) {
$response = $e->getResponse();
preg_match("/{.*}/",$response['msg'],$data); preg_match("/{.*}/",$response['msg'],$data);
$msg = isset($data['0'])?$data['0']:''; $msg = isset($data['0'])?$data['0']:'';
return json_decode($msg,true);
$data = json_decode($msg,true);
} else {
$data['msg'] = $e->getMessage();
$data['code'] = $e->getCode();
$data['file'] = $e->getFile().' '.$e->getLine();
}
return $data;
} }
} }
\ No newline at end of file
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