You are here

protected function SamlController::handleException in SAML Authentication 8.2

Displays error message and logs full exception.

Parameters

$exception: The exception thrown.

string $while: A description of when the error was encountered.

5 calls to SamlController::handleException()
SamlController::acs in src/Controller/SamlController.php
Attribute Consumer Service.
SamlController::login in src/Controller/SamlController.php
Initiates a SAML2 authentication flow.
SamlController::logout in src/Controller/SamlController.php
Initiate a SAML2 logout flow.
SamlController::metadata in src/Controller/SamlController.php
Displays service provider metadata XML for iDP autoconfiguration.
SamlController::sls in src/Controller/SamlController.php
Single Logout Service.

File

src/Controller/SamlController.php, line 332

Class

SamlController
Returns responses for samlauth module routes.

Namespace

Drupal\samlauth\Controller

Code

protected function handleException($exception, $while = '') {
  if ($while) {
    $while = " {$while}";
  }

  // We use the same format for logging as Drupal's ExceptionLoggingSubscriber
  // except we also specify where the error was encountered. (The options are
  // limited, so we make this part of the message, not a context parameter.)
  $error = Error::decodeException($exception);
  unset($error['severity_level']);
  $this
    ->getLogger('samlauth')
    ->critical("%type encountered while {$while}: @message in %function (line %line of %file).", $error);

  // Don't expose the error to prevent information leakage; the user probably
  // can't do much with it anyway. But hint that more details are available.
  drupal_set_message("Error {$while}; details have been logged.", 'error');
}