服务端异常处理 报错 Recv is not supported

Aperta
#3 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
php
Ambito
api, backend

Direzione di ricerca

Inizia da vendor/hyperf/rpc-multiplex/src/Transporter.php:74 e traccia la richiesta di registrazione da app/Http/Api/Controller/User/UserController.php:40 attraverso le chiamate del client RPC mostrate nello stack trace. Riproduci la richiesta e identifica perché Recv non è supportato; il lavoro è completato quando la causa e il comportamento previsto del trasporto o della gestione degli errori sono stati stabiliti e la registrazione non produce più questa eccezione non gestita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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);
}

}`

Lingua principale
PHP
Stelle
7
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.