src/Sonic/Routing/Router.php
public function error($arg = null)
    {
        if (is_callable($arg)) {
            // Set provided callback function as error handler
            $this->error_handler = $arg;
        }
        else {
            // Set HTTP status on router
            $this->current_http_status = \Symfony\Component\HttpFoundation\Response::HTTP_INTERNAL_SERVER_ERROR;

            // Execute error handler and set result as response content
            $result = is_callable($this->error_handler) === TRUE
                ? call_user_func($this->error_handler, $arg)
                : $this->default_error_handler($arg)->execute();

            $this->response->setContent($result);

            // Set response's status code
            $this->response->setStatusCode($this->current_http_status);

            // Send response
            $this->response->send();
        }
    }
public function error($arg = null)
    {
        if (is_callable($arg)) {
            // Set provided callback function as error handler
            $this->error_handler = $arg;
        }
        else {
            // Set HTTP status on router
            $this->current_http_status = \Symfony\Component\HttpFoundation\Response::HTTP_INTERNAL_SERVER_ERROR;

            // Execute error handler and set result as response content
            $result = is_callable($this->error_handler) === TRUE
                ? call_user_func($this->error_handler, $arg)
                : $this->default_error_handler($arg)->execute();

            $this->response->setContent($result);

            // Set response's status code
            $this->response->setStatusCode($this->current_http_status);

            // Send response
            $this->response->send();
        }
    }
This method can either set the callback to execute on a 'Server error' (50x)
error, or it invokes the callback
To set the callback, provide a function to the method
To invoke the callback, call the method with a string detailing the error
as a parameter

@param  \Closure|\Exception $arg
@return