private function handleException(\Throwable $t, Request $request)
    {
        if ($this->log !== null) {
            $this->log->error('Exception thrown inside a controller.', array(
                    'exception' => $t,
            ));
        } else {
            // If no logger is set, let's log in PHP error_log
            error_log($t->getMessage().' - '.$t->getTraceAsString());
        }

        $response = SplashUtils::buildControllerResponse(
            function () use ($t, $request) {
                return $this->errorController->serverError($t, $request);
            }
        );

        return $response;
    }