protected function prepareReplacements(Exception $exception)
{
$statusCode = $this->getStatusCode($exception);
if (!($message = $exception->getMessage())) {
$message = sprintf('%d %s', $statusCode, Response::$statusTexts[$statusCode]);
}
$replacements = [':message' => $message, ':status_code' => $statusCode];
if ($exception instanceof MessageBagErrors && $exception->hasErrors()) {
$replacements[':errors'] = $exception->getErrors();
}
if ($code = $exception->getCode()) {
$replacements[':code'] = $code;
}
if ($this->runningInDebugMode()) {
$replacements[':debug'] = ['line' => $exception->getLine(), 'file' => $exception->getFile(), 'class' => get_class($exception), 'trace' => explode("\n", $exception->getTraceAsString())];
}
return array_merge($replacements, $this->replacements);
}