Commit ffaa1eaa by feixiang

parseData 优化

parent 55cb338f
...@@ -9,7 +9,7 @@ namespace Hdll\Services\Common\Exception; ...@@ -9,7 +9,7 @@ namespace Hdll\Services\Common\Exception;
class ExceptionParseData class ExceptionParseData
{ {
public static function parseData(\Exception $e) public static function parseData(\Throwable $e)
{ {
if ( is_callable([$e,'getResponse']) ) { if ( is_callable([$e,'getResponse']) ) {
$response = $e->getResponse(); $response = $e->getResponse();
...@@ -19,6 +19,7 @@ class ExceptionParseData ...@@ -19,6 +19,7 @@ class ExceptionParseData
$msg = isset($data['0'])?$data['0']:''; $msg = isset($data['0'])?$data['0']:'';
$data = json_decode($msg,true); $data = json_decode($msg,true);
$data = empty($data)?$response:$data;
} else { } else {
$data['msg'] = $e->getMessage(); $data['msg'] = $e->getMessage();
$data['code'] = 500; $data['code'] = 500;
......
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