You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fetch-error.js 713B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict'
  2. class FetchError extends Error {
  3. constructor (message, type, systemError) {
  4. super(message)
  5. this.code = 'FETCH_ERROR'
  6. // pick up code, expected, path, ...
  7. if (systemError) {
  8. Object.assign(this, systemError)
  9. }
  10. this.errno = this.code
  11. // override anything the system error might've clobbered
  12. this.type = this.code === 'EBADSIZE' && this.found > this.expect
  13. ? 'max-size' : type
  14. this.message = message
  15. Error.captureStackTrace(this, this.constructor)
  16. }
  17. get name () {
  18. return 'FetchError'
  19. }
  20. // don't allow name to be overwritten
  21. set name (n) {}
  22. get [Symbol.toStringTag] () {
  23. return 'FetchError'
  24. }
  25. }
  26. module.exports = FetchError