This commit is contained in:
2021-03-30 11:56:29 +08:00
parent 4171727784
commit 482f593e3b
21 changed files with 40 additions and 24 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ abstract class Callback extends HttpService
$this->eventNotify($message);
} catch (\Throwable $exception) {
$this->addError($exception);
$this->addError($exception,'throwable');
}
}
+1
View File
@@ -66,6 +66,7 @@ class Client extends ClientAbstracts
}
return $this->fail($client->getStatusCode(), $message, $body, $client->getHeaders());
} catch (\Throwable $exception) {
$this->addError($exception,'rpc');
return $this->fail(500, $exception->getMessage(), [
'file' => $exception->getFile(),
'line' => $exception->getLine()
+1 -1
View File
@@ -35,7 +35,7 @@ class OnClose extends Callback
try {
$this->execute($server, $fd);
} catch (\Throwable $exception) {
$this->addError($exception);
$this->addError($exception,'throwable');
} finally {
fire(Event::SYSTEM_RESOURCE_RELEASES);
logger()->insert();
+1 -1
View File
@@ -97,7 +97,7 @@ class OnHandshake extends Callback
$eventName = 'listen ' . $clientInfo['server_port'] . ' ' . Event::SERVER_HANDSHAKE;
$event->trigger($eventName, [$request, $response]);
} catch (\Throwable $exception) {
$this->addError($exception);
$this->addError($exception,'throwable');
$this->disconnect($response, 500);
} finally {
fire(Event::SYSTEM_RESOURCE_CLEAN);
+1
View File
@@ -65,6 +65,7 @@ class OnRequest extends Callback
return $result;
} catch (ExitException | Error | \Throwable $exception) {
$this->addError($exception, 'throwable');
return $this->sendErrorMessage($request, $response, $exception);
} finally {
$this->event->trigger(Event::SYSTEM_RESOURCE_RELEASES);
+1 -1
View File
@@ -118,7 +118,7 @@ class OnTask extends Callback
} catch (\Throwable $exception) {
$finish['status'] = 'error';
$finish['info'] = $this->format($exception);
$this->error($exception, 'Task');
$this->addError($exception, 'Task');
return $finish;
} finally {
+1 -1
View File
@@ -73,7 +73,7 @@ class OnWorkerStart extends Callback
try {
fire(Event::SERVER_WORKER_START, [$worker_id]);
} catch (\Throwable $exception) {
$this->addError($exception);
$this->addError($exception,'throwable');
write($exception->getMessage(), 'worker');
}
}
+2 -2
View File
@@ -287,7 +287,7 @@ class Node extends HttpService
return [$reflect->newInstance(), $action];
} catch (Throwable $exception) {
$this->_error = $exception->getMessage();
$this->error($exception, 'router');
$this->addError($exception, 'router');
return null;
}
}
@@ -592,7 +592,7 @@ class Node extends HttpService
}
return $this->runWith(...func_get_args());
} catch (Throwable $throwable) {
$this->error($throwable->getMessage());
$this->addError($throwable->getMessage(),'throwable');
return Json::to(401, $throwable->getMessage());
}
}
+1
View File
@@ -38,6 +38,7 @@ class Reduce
}
return $pipe->onHandler($request, $passable);
} catch (\Throwable $throwable) {
logger()->addError($throwable, 'throwable');
return Json::to(0, $throwable);
}
};
+2 -2
View File
@@ -515,7 +515,7 @@ class Router extends HttpService implements RouterInterface
}
return $node->afterDispatch($response);
} catch (\Throwable $exception) {
$this->addError($exception);
$this->addError($exception,'throwable');
$Code = $exception->getCode() == 0 ? 500 : $exception->getCode();
@@ -659,7 +659,7 @@ class Router extends HttpService implements RouterInterface
$router = $this;
include_once "{$files}";
} catch (\Throwable $exception) {
$this->error($exception);
$this->addError($exception,'throwable');
} finally {
if (isset($exception)) {
unset($exception);
+1 -1
View File
@@ -520,7 +520,7 @@ class Server extends HttpService
$annotation->instanceDirectoryFiles(RPC_SERVICE_PATH);
$annotation->instanceDirectoryFiles(RPC_CLIENT_PATH);
} catch (\Throwable $exception) {
$this->addError($exception);
$this->addError($exception,'throwable');
}
});
}