Piwik\Plugins\API\Renderer\Html::renderException PHP Method

renderException() public method

public renderException ( $message, Exception | Throwable $exception ) : string
$message
$exception Exception | Throwable
return string
    public function renderException($message, $exception)
    {
        Common::sendHeader('Content-Type: text/plain; charset=utf-8', true);
        return nl2br($message);
    }

Usage Example

    public function test_renderException_shouldConvertNewLinesToBr()
    {
        $response = $this->builder->renderException("The\nerror\nmessage", new \Exception('The other message'));
        $this->assertEquals('The<br />
error<br />
message', $response);
    }