errors.js 589 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. class ExtendableError extends Error {
  3. constructor(message) {
  4. super(message);
  5. // @ts-ignore
  6. this.name = this.constructor.name;
  7. this.message = message;
  8. if (typeof Error.captureStackTrace === "function") {
  9. Error.captureStackTrace(this, this.constructor);
  10. } else {
  11. this.stack = new Error(message).stack;
  12. }
  13. }
  14. }
  15. /* eslint-disable no-useless-constructor */
  16. class TimeoutError extends ExtendableError {
  17. constructor(m) {
  18. super(m);
  19. }
  20. }
  21. /* eslint-enable no-useless-constructor */
  22. module.exports = {
  23. TimeoutError: TimeoutError
  24. };