public function exceptionHandler($message)
    {
        $errorCode = $message->getCode()?: 404;

        if($this->customErrorViewExist($errorCode)) {
            $this->response->send(
                view("errors.{$errorCode}")
            );
        }

        error_log("planet.ERROR ".$message->getMessage() . "\nStack trace:\n" . $message->getTraceAsString());

        if(php_sapi_name() == 'cli') {
            (new ConsoleApplication)->renderException($message, new ConsoleOutput);
        } else {
            $debugMode = filter_var($this->app->config->getApp('debug'), FILTER_VALIDATE_BOOLEAN);

            $exceptionHandler = new ExceptionHandler($debugMode);

            $exceptionHandler->sendPhpResponse($message);
        }
    }