private function errorHandling(?bool $isConsole = false)
  {
    $this->internalErrors();

    $whoopsRun     = new WhoopsRun;
    $development   = new PrettyPageHandler;
    $errors        = new Error;
    $production    = new CallbackHandler($this->uiRegister());
    $cliErrors     = new CallbackHandler($this->cliRegister());

    $development->setPageTitle("Whoops! There was a problem.");

    foreach ($_ENV as $key => $value) {
      if (str_contains(strtolower($key), ['password', 'key', 'token', 'port', 'user', 'connection', 'host', 'database'])) {
        $development->blacklist('_ENV', $key);
      }
    }

    foreach ($_SERVER as $key => $value) {
      if (str_contains(strtolower($key), ['filename', 'script_name', 'php_self', 'document', 'password', 'key', 'token', 'port', 'user', 'connection', 'host', 'database'])) {
        $development->blacklist('_SERVER', $key);
      }
    }

    $whoopsRun->pushHandler(
      $isConsole ? $cliErrors : (config('app.debug') ? $development : $production)
    );

    if (Misc::isAjaxRequest()) {
      $errors->ajax = true;
    }

    $bugsnag = \Bugsnag\Client::make();
    \Bugsnag\Handler::register($bugsnag);

    $whoopsRun->handleShutdown();
    $whoopsRun->register();
  }