服务端异常处理 报错 Recv is not supported
- Dominant language
- PHP
- Stars
- 7
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
`
string(31) "Hyperf\RpcMultiplex\Transporter"
[ERROR] Hyperf\RpcMultiplex\Exception\NotSupportException: Recv is not supported. in /www/im/im-api/vendor/hyperf/rpc-multiplex/src/Transporter.php:74
Stack trace:
#0 /www/im/im-api/vendor/hyperf/rpc-client/src/Client.php(46): Hyperf\RpcMultiplex\Transporter->recv()
#1 /www/im/im-api/vendor/hyperf/rpc-client/src/AbstractServiceClient.php(243): Hyperf\RpcClient\Client->recv()
#2 /www/im/im-api/vendor/hyperf/rpc-client/src/ServiceClient.php(53): Hyperf\RpcClient\AbstractServiceClient->checkRequestIdAndTryAgain()
#3 /www/im/im-api/vendor/hyperf/rpc-client/src/ServiceClient.php(83): Hyperf\RpcClient\ServiceClient->__request()
#4 /www/im/im-api/runtime/container/proxy/App_Rpc_User_UserAuthRpcInterface.rpc-client.proxy.php(13): Hyperf\RpcClient\ServiceClient->__call()
#5 /www/im/im-api/app/Http/Api/Controller/User/UserController.php(40): App\Rpc\User\UserAuthRpcInterface_21f1b2f12bc808f3e929d80230a39e41->register()
#6 /www/im/im-api/runtime/container/proxy/Hyperf_HttpServer_CoreMiddleware.proxy.php(131): App\Http\Api\Controller\User\UserController->register()
#7 /www/im/im-api/runtime/container/proxy/Hyperf_HttpServer_CoreMiddleware.proxy.php(87): Hyperf\HttpServer\CoreMiddleware->handleFound()
#8 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Hyperf\HttpServer\CoreMiddleware->process()
#9 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest()
#10 /www/im/im-api/vendor/hyperf/validation/src/Middleware/ValidationMiddleware.php(83): Hyperf\Dispatcher\HttpRequestHandler->handle()
#11 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Hyperf\Validation\Middleware\ValidationMiddleware->process()
#12 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest()
#13 /www/im/im-api/vendor/mineadmin/support/Middleware/CorsMiddleware.php(29): Hyperf\Dispatcher\HttpRequestHandler->handle()
#14 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Mine\Support\Middleware\CorsMiddleware->process()
#15 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest()
#16 /www/im/im-api/vendor/mineadmin/support/Middleware/TranslationMiddleware.php(30): Hyperf\Dispatcher\HttpRequestHandler->handle()
#17 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Mine\Support\Middleware\TranslationMiddleware->process()
#18 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest()
#19 /www/im/im-api/vendor/mineadmin/support/Middleware/RequestIdMiddleware.php(26): Hyperf\Dispatcher\HttpRequestHandler->handle()
#20 /www/im/im-api/vendor/hyperf/dispatcher/src/AbstractRequestHandler.php(45): Mine\Support\Middleware\RequestIdMiddleware->process()
#21 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpRequestHandler.php(27): Hyperf\Dispatcher\AbstractRequestHandler->handleRequest()
#22 /www/im/im-api/vendor/hyperf/dispatcher/src/HttpDispatcher.php(35): Hyperf\Dispatcher\HttpRequestHandler->handle()
#23 /www/im/im-api/vendor/hyperf/http-server/src/Server.php(112): Hyperf\Dispatcher\HttpDispatcher->dispatch()
#24 [internal function]: Hyperf\HttpServer\Server->onRequest()
#25 {main}
`
我的异常处理代码
`
public function handle(Throwable $throwable, ResponseInterface $response)
{
if ($throwable instanceof HttpException) {
return $this->response->handleException($throwable);
}
if ($throwable instanceof BusinessException) {
$this->logger->warning($this->format_throwable($throwable));
return $this->response->fail($throwable->getCode(), $throwable->getMessage());
}
$this->logger->error($this->format_throwable($throwable));
return $this->response->fail(ResultCode::FAIL, 'Server Error');
}
public function isValid(Throwable $throwable): bool
{
return true;
}
function format_throwable(Throwable $throwable): string
{
return $this->container->get(FormatterInterface::class)->format($throwable);
}
}`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.