Skip to content

Commit

Permalink
ADD PSR-3 exception error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
srjlewis committed Nov 1, 2024
1 parent 4bdad0e commit 18b811f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/JsonRPC/Request/RequestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ protected function handleExceptions(Exception $e)
->withException($e)
->build();
} elseif($this->psr3Logger) {
$this->psr3Logger->error(
$e->getMessage(), ['file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace()]
$this->psr3Logger->critical(
$e->getMessage(), ['code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace()]
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/JsonRPC/Response/ResponseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ protected function handleExceptions()
protected function logException(\Exception $e): void
{
if (!($e->getCode() >= -32099 && $e->getCode() <= -32000) && $this->psr3Logger) {
$this->psr3Logger->error(
$this->psr3Logger->critical(
$e->getMessage(),
['file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace()]
['code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace()]
);
}
}
Expand Down

0 comments on commit 18b811f

Please sign in to comment.