Ejemplo n.º 1
0
 /**
  * Render the exception (debug)
  *
  * @param object      $exception
  * @param string|null $outputBuffer
  * @return array title, output
  */
 protected function doRenderDebug($exception, $outputBuffer = null)
 {
     $title = 'An error has occured';
     $output = Debug::renderException($exception, true, true);
     $this->emit('render.debug', array('title' => &$title, 'output' => &$output, 'exception' => $exception, 'output_buffer' => $outputBuffer, 'screen' => $this));
     return array($title, $output);
 }
Ejemplo n.º 2
0
 /**
  * Handle a fatal condition
  *
  * @param FatalErrorHandlerInterface $fatalHandler
  * @param object                     $exception
  */
 public function handleFatal(FatalErrorHandlerInterface $fatalHandler, $exception)
 {
     // replace headers
     if (!$this->isCli()) {
         Debug::replaceHeaders(array('HTTP/1.1 500 Internal Server Error'));
     }
     // clean output buffers
     $outputBuffer = $this->cleanBuffers ? Debug::cleanBuffers(null, true, true) : null;
     // handle
     $fatalHandler->handle($exception, $this->debug, $outputBuffer);
 }
Ejemplo n.º 3
0
    /**
     * Render a plaintext exception trace
     *
     * @param object $exception
     * @return string
     */
    public function renderPlaintextTrace($exception)
    {
        $trace = Debug::renderException($exception, true, true);
        $trace[strlen($trace) - 1] = '';
        // drop the last newline
        $rows = 1 + min(10, preg_match_all('/\\r\\n|\\n|\\r/', $trace, $matches));
        return <<<HTML
<div class="group">
    <div class="section">
        <h2 class="toggle-control closed" onclick="Kuria.Error.WebErrorScreen.toggle('plaintext-trace', this)">Plaintext trace</h2>
        <div id="plaintext-trace" class="hidden">
            <textarea readonly rows="{$rows}" cols="80" onclick="Kuria.Error.WebErrorScreen.selectTextareaContent(this)">{$this->escape($trace)}</textarea>
        </div>
    </div>
</div>

HTML;
    }