Ejemplo n.º 1
0
 /**
  * Handle exception from scriptlet
  *
  * @param   scriptlet.Response $response
  * @param   lang.Throwable $t
  * @param   int $status
  * @param   bool $trace whether to show stacktrace
  * @return  scriptlet.HttpScriptletResponse
  */
 protected function error($response, \lang\Throwable $t, $status, $trace)
 {
     $package = $this->getClass()->getPackage();
     $errorPage = $package->getResource($package->providesResource('error' . $status . '.html') ? 'error' . $status . '.html' : 'error500.html');
     $response->setProcessed(false);
     $response->setStatus($status);
     $response->setContent(str_replace('<xp:value-of select="reason"/>', $trace ? $t->toString() : $t->getMessage(), $errorPage));
 }