Skip to content

Commit

Permalink
Fix exception controller authentication exceptions
Browse files Browse the repository at this point in the history
Exceptions thrown while not logged in are wrapped in a HttpException.
This is preventing the rendering of sane error message for the enduser.
  • Loading branch information
pablothedude committed Jan 22, 2020
1 parent 56e2b7e commit abb1eb7
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Exception;
use Surfnet\StepupBundle\Controller\ExceptionController as BaseExceptionController;
use Surfnet\StepupSelfService\SelfServiceBundle\Exception\MissingRequiredAttributeException;
use Symfony\Component\HttpKernel\Exception\HttpException;

final class ExceptionController extends BaseExceptionController
{
Expand All @@ -32,9 +33,11 @@ protected function getPageTitleAndDescription(Exception $exception)
{
$translator = $this->getTranslator();

if ($exception instanceof MissingRequiredAttributeException) {
$title = $translator->trans('stepup.error.missing_required_attribute.title');
$description = $exception->getMessage();
if ($exception instanceof HttpException) {
if ($exception instanceof MissingRequiredAttributeException) {
$title = $translator->trans('stepup.error.missing_required_attribute.title');
$description = $exception->getMessage();
}
}

if (isset($title) && isset($description)) {
Expand Down

0 comments on commit abb1eb7

Please sign in to comment.