code: public static function send500Error($error, $debug = false, $exitWhenDone = false)
      {
          $response = [
              'errors' => [FormattedError::createFromException($error, $debug)],
          ];
          $helper   = new Helper();
          $helper->emitResponse($response, 500, $exitWhenDone);
      }
docs: Converts and exception to error and sends spec-compliant HTTP 500 error.
  Useful when an exception is thrown somewhere outside of server execution context
  (e.g. during schema instantiation).
  
  @param Throwable $error
  @param bool      $debug
  @param bool      $exitWhenDone
  
  @api