diff --git a/src/RpcClient.php b/src/RpcClient.php index 96ebd9e..1cad61f 100644 --- a/src/RpcClient.php +++ b/src/RpcClient.php @@ -107,13 +107,17 @@ private function callback(Response $response, ServiceCall $serviceCall) $globalCall = $this->clientConfig->getOnGlobalFail(); $call = $serviceCall->getOnFail(); } - - if (is_callable($globalCall)) { - call_user_func($globalCall, $response, $serviceCall); - } - - if (is_callable($call)) { - call_user_func($call, $response, $serviceCall); + //全局回调出错不应该影响业务逻辑回调 + try{ + if (is_callable($globalCall)) { + call_user_func($globalCall, $response, $serviceCall); + } + }catch (\Throwable $throwable){ + throw $throwable; + } finally { + if (is_callable($call)) { + call_user_func($call, $response, $serviceCall); + } } } } \ No newline at end of file diff --git a/src/TcpClient.php b/src/TcpClient.php index 9002373..309cdc5 100644 --- a/src/TcpClient.php +++ b/src/TcpClient.php @@ -38,7 +38,7 @@ function recv(float $timeout = 3.0):Response }else{ return new Response([ 'status'=>Response::STATUS_SERVICE_ERROR, - 'message'=>$data + 'msg'=>$data ]); } }else{