服务端异常处理 报错 Recv is not supported
还没有人认领这个 Issue。
评估
调研方向
从 vendor/hyperf/rpc-multiplex/src/Transporter.php:74 开始,跟踪来自 app/Http/Api/Controller/User/UserController.php:40 的注册请求,经过 stack trace 中显示的 RPC 客户端调用。重现该请求,并确定为什么不支持 Recv;当原因以及预期的传输或错误处理行为得到确定,且注册不再产生此未处理异常时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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);
}
}`
- 主要语言
- PHP
- 星标
- 7
- 派生
- 2
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 3 天内回复
-
难度 1/5 1 小时以内 新手友好度 91/100
benjaminkott/bootstrap_package#1675 ·
-
sync-en
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复