'status' =>
(string) $status_code,
'detail' =>
$exception->
getMessage(),
];
$error['links'
]['via'
]['href'
] = \Drupal::
request()->
getUri();
// Provide an "info" link by default: if the exception carries a single
// "Link" header, use that, otherwise fall back to the HTTP spec section
// covering the exception's status code.
$headers =
$exception->
getHeaders();
if (isset($headers['Link'
]) && !
is_array($headers['Link'
])) { $error['links'
]['info'
]['href'
] =
$headers['Link'
];
} elseif ($info_url =
$this->
getInfoUrl($status_code)) { $error['links'
]['info'
]['href'
] =
$info_url;
} // Exceptions thrown without an explicitly defined code get assigned zero by
// default. Since this is no helpful information, omit it.
if ($exception->
getCode() !== 0
) { $error['code'
] =
(string) $exception->
getCode();
} $is_verbose_reporting = \Drupal::
config('system.logging'
)->
get('error_level'
) === ERROR_REPORTING_DISPLAY_VERBOSE;
$site_report_access =
$this->currentUser->
hasPermission('access site reports'
);
if ($site_report_access &&
$is_verbose_reporting) {