Commit a5966701 by zhufx

解析异常信息

parent 193886da
...@@ -11,28 +11,12 @@ class ExceptionParseData ...@@ -11,28 +11,12 @@ class ExceptionParseData
{ {
public static function parseData(\Exception $e) public static function parseData(\Exception $e)
{ {
$exception = $e->getMessage(); $response = $e->getResponse();
$pos = strpos($exception,"the return status of rpc is incorrected,data");
if ( false !== $pos ) {
$exception = str_replace("the return status of rpc is incorrected,data=","",$exception);
$throw_data = json_decode($exception,true); preg_match("/{.*}/",$response['msg'],$data);
$parse_data = explode(' ',$throw_data['msg']); $msg = isset($data['0'])?$data['0']:'';
$data = ['msg' => $parse_data[0], 'file' => $parse_data[1], 'line' => $parse_data[2], 'code' => $throw_data['status']];
} else {
$file = $e->getFile();
$line = $e->getLine();
$code = $e->getCode();
$exception = $e->getMessage();
$data = ['msg' => $exception, 'file' => $file, 'line' => $line, 'code' => $code];
}
return $data;
return json_decode($msg,true);
} }
......
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