Skip to content

Commit

Permalink
Merge pull request #813 from gam6itko/core_handler_exc_mapping
Browse files Browse the repository at this point in the history
CoreHandler do not mention internal errors in ClientException
  • Loading branch information
butschster committed Oct 14, 2022
2 parents 9934087 + a1501eb commit 0a300a3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Router/src/CoreHandler.php
Expand Up @@ -153,11 +153,11 @@ private function wrapResponse(Response $response, mixed $result = null, string $
private function mapException(ControllerException $exception): ClientException
{
return match ($exception->getCode()) {
ControllerException::BAD_ACTION => new NotFoundException($exception->getMessage()),
ControllerException::NOT_FOUND => new NotFoundException($exception->getMessage()),
ControllerException::FORBIDDEN => new ForbiddenException($exception->getMessage()),
ControllerException::UNAUTHORIZED => new UnauthorizedException($exception->getMessage()),
default => new BadRequestException($exception->getMessage()),
ControllerException::BAD_ACTION,
ControllerException::NOT_FOUND => new NotFoundException('Not found', $exception),
ControllerException::FORBIDDEN => new ForbiddenException('Forbidden', $exception),
ControllerException::UNAUTHORIZED => new UnauthorizedException('Unauthorized', $exception),
default => new BadRequestException('Bad request', $exception),
};
}
}

0 comments on commit 0a300a3

Please sign in to comment.