TP6 workerman運行時使用json輸出錯誤會產生異常

瀏覽:849 發布日期:2019/11/07
5.0.0 - 致命 - 未處理
tp6版本 使用workerman運行
我重寫了錯誤錯誤,將錯誤輸出為json    public function render($request, Throwable $e): Response
    {
        // 添加自定義異常處理機制

        // 其他錯誤交給系統處理
//        return parent::render($request, $e);
        $this->isJson = true;
        if ($e instanceof HttpResponseException) {
            return $e->getResponse();
        } elseif ($e instanceof HttpException) {
            return $this->renderHttpException($e);
        } else {
            return $this->convertExceptionToResponse($e);
        }
    }
然后運行的命令行就會報錯:InvalidArgumentException: Recursion detected in /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/response/Json.php:54
Stack trace:
#0 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/Response.php(384): think\response\Json->output(false)
#1 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/Application.php(92): think\Response->getContent()
#2 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/Application.php(67): think\worker\Application->exception(Object(Workerman\Connection\TcpConnection), Object(InvalidArgumentException))
#3 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/Http.php(161): think\worker\Application->worker(Object(Workerman\Connection\TcpConnection), Array)
#4 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Connection/TcpConnection.php(658): think\worker\Http->onMessage(Object(Workerman\Connection\TcpConnection), Array)
#5 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Events/Select.php(294): Workerman\Connection\TcpConnection->baseRead(Resource id #194)
#6 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(2382): Workerman\Events\Select->loop()
#7 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(1490): Workerman\Worker->run()
#8 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(1320): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker))
#9 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(1294): Workerman\Worker::forkWorkersForLinux()
#10 /mnt/d/webProject/electric_energize_php_api/vendor/workerman/workerman/Worker.php(509): Workerman\Worker::forkWorkers()
#11 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/Http.php(278): Workerman\Worker::runAll()
#12 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/think-worker/src/command/Worker.php(135): think\worker\Http->start()
#13 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/console/Command.php(210): think\worker\command\Worker->execute(Object(think\console\Input), Object(think\console\Output))
#14 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/Console.php(600): think\console\Command->run(Object(think\console\Input), Object(think\console\Output))
#15 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/Console.php(259): think\Console->doRunCommand(Object(think\worker\command\Worker), Object(think\console\Input), Object(think\console\Output))
#16 /mnt/d/webProject/electric_energize_php_api/vendor/topthink/framework/src/think/Console.php(196): think\Console->doRun(Object(think\console\Input), Object(think\console\Output))
#17 /mnt/d/webProject/electric_energize_php_api/think(10): think\Console->run()
#18 {main}
Worker[24902] process terminated
worker[thinkphp:24902] exit with status 64000
接著客戶端就會收不到任何響應。
評論(
后面還有條評論,點擊查看>>
广西快3开奖走势图一定牛