container->pageBuilder->reset(); if ($throwable instanceof ShaarliFrontException) { // Functional error $this->assignView('message', nl2br($throwable->getMessage())); $response = $response->withStatus($throwable->getCode()); } else { // Internal error (any other Throwable) if ($this->container->conf->get('dev.debug', false) || $this->container->loginManager->isLoggedIn()) { $this->assignView('message', t('Error: ') . $throwable->getMessage()); $this->assignView( 'text', '' . t('Please report it on Github.') . '' ); $this->assignView('stacktrace', exception2text($throwable)); } else { $this->assignView('message', t('An unexpected error occurred.')); } $response = $response->withStatus(500); } return $response->write($this->render('error')); } }