http-error.js 506 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const http_1 = require("http");
  4. /**
  5. * Error subclass to use when an HTTP application error has occurred.
  6. */
  7. class HTTPError extends Error {
  8. constructor(statusCode, message = http_1.STATUS_CODES[statusCode]) {
  9. super(message);
  10. this.statusCode = statusCode;
  11. this.code = `E${String(message).toUpperCase().replace(/\s+/g, '')}`;
  12. }
  13. }
  14. exports.default = HTTPError;
  15. //# sourceMappingURL=http-error.js.map