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
  • Loading branch information
spiralbot committed Oct 14, 2022
1 parent 9b85767 commit e08f9a2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions 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 e08f9a2

Please sign in to comment.