Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

fix validation exception message #46

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Aimed to be lightweight, this bundle does not depend on FOSRestBundle or Twig (e

Go to the [release page](https://github.com/kleijnweb/swagger-bundle/releases) to find details about the latest release.

__This bundle is currently actively maintained.__

For a pretty complete example, see [swagger-bundle-example](https://github.com/kleijnweb/swagger-bundle-example).

# This Bundle..

## Will:
Expand Down
3 changes: 2 additions & 1 deletion src/EventListener/ExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace KleijnWeb\SwaggerBundle\EventListener;

use KleijnWeb\SwaggerBundle\Exception\InvalidParametersException;
use KleijnWeb\SwaggerBundle\Response\VndErrorResponse;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -72,7 +73,7 @@ public function onKernelException(GetResponseForExceptionEvent $event)
} else {
switch (substr($code, 0, 1)) {
case '4':
$message = 'Input Error';
$message = get_class($exception) === InvalidParametersException::class ? $exception->getMessage() : 'Input Error';
$this->logger->notice("Input error [logref $logRef]: " . $exception->__toString());
break;
case '5':
Expand Down