CanceledError.js 697 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. import AxiosError from '../core/AxiosError.js';
  3. import utils from '../utils.js';
  4. /**
  5. * A `CanceledError` is an object that is thrown when an operation is canceled.
  6. *
  7. * @param {string=} message The message.
  8. * @param {Object=} config The config.
  9. * @param {Object=} request The request.
  10. *
  11. * @returns {CanceledError} The created error.
  12. */
  13. function CanceledError(message, config, request) {
  14. // eslint-disable-next-line no-eq-null,eqeqeq
  15. AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
  16. this.name = 'CanceledError';
  17. }
  18. utils.inherits(CanceledError, AxiosError, {
  19. __CANCEL__: true
  20. });
  21. export default CanceledError;