TimeoutError.js 778 B

123456789101112131415161718192021222324252627
  1. /** @license MIT License (c) copyright 2010-2014 original author or authors */
  2. /** @author Brian Cavalier */
  3. /** @author John Hann */
  4. (function(define) { 'use strict';
  5. define(function() {
  6. /**
  7. * Custom error type for promises rejected by promise.timeout
  8. * @param {string} message
  9. * @constructor
  10. */
  11. function TimeoutError (message) {
  12. Error.call(this);
  13. this.message = message;
  14. this.name = TimeoutError.name;
  15. if (typeof Error.captureStackTrace === 'function') {
  16. Error.captureStackTrace(this, TimeoutError);
  17. }
  18. }
  19. TimeoutError.prototype = Object.create(Error.prototype);
  20. TimeoutError.prototype.constructor = TimeoutError;
  21. return TimeoutError;
  22. });
  23. }(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));