Skip to content

Commit 468a773

Browse files
committed
Merge pull request #647 from entering/status-code-message-instead-empty
At Exception controller show status code message
2 parents c7adf7b + 746f99b commit 468a773

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Controller/ExceptionController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ protected function getExceptionMessage($exception)
173173
$exceptionMap = $this->container->getParameter('fos_rest.exception.messages');
174174
$showExceptionMessage = $this->isSubclassOf($exception, $exceptionMap);
175175

176-
return $showExceptionMessage || $this->container->get('kernel')->isDebug() ? $exception->getMessage() : '';
176+
return $showExceptionMessage || $this->container->get('kernel')->isDebug()
177+
? $exception->getMessage()
178+
: Response::$statusTexts[$this->getStatusCode($exception)];
177179
}
178180

179181
/**
@@ -186,7 +188,7 @@ protected function getExceptionMessage($exception)
186188
protected function getStatusCode($exception)
187189
{
188190
$exceptionMap = $this->container->getParameter('fos_rest.exception.codes');
189-
$isExceptionMappedToStatusCode = $this->isSubclassOf($exception, $exceptionMap);;
191+
$isExceptionMappedToStatusCode = $this->isSubclassOf($exception, $exceptionMap);
190192

191193
return ($isExceptionMappedToStatusCode) ? $isExceptionMappedToStatusCode : $exception->getStatusCode();
192194
}

0 commit comments

Comments
 (0)