src/PicoAuthPlugin.php
protected function errorHandler(\Exception $e, $url = "")
    {
        $this->errorOccurred = true;
        $this->requestFile = $this->pluginDir . '/content/error.md';
        if ($this->config["debug"] === true) {
            $this->addOutput("_exception", (string)$e);
        }
        $this->logger->critical(
            "Exception on url '{url}': {e}",
            array(
                "url" => $url,
                "e" => $e
            )
        );
        header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);

        // Change url to prevent other plugins that use url-based routing from
        // changing the request file.
        $this->requestUrl="500";
    }
protected function errorHandler(\Exception $e, $url = "")
    {
        $this->errorOccurred = true;
        $this->requestFile = $this->pluginDir . '/content/error.md';
        if ($this->config["debug"] === true) {
            $this->addOutput("_exception", (string)$e);
        }
        $this->logger->critical(
            "Exception on url '{url}': {e}",
            array(
                "url" => $url,
                "e" => $e
            )
        );
        header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);

        // Change url to prevent other plugins that use url-based routing from
        // changing the request file.
        $this->requestUrl="500";
    }
Fatal error handler

If an uncaught exception raises from the auth module, an error
page will be rendered and HTTP 500 code returned.
The error details are logged, and if "debug: true" is set in the plugin
configuration, the error details are displayed also on the error page.

@param \Exception $e Exception from the module
@param string $url Pico page id that was being loaded