|
|
@ -14,7 +14,6 @@ const lowercaseKeys = require('lowercase-keys'); |
|
|
|
const isRedirect = require('is-redirect'); |
|
|
|
const unzipResponse = require('unzip-response'); |
|
|
|
const createErrorClass = require('create-error-class'); |
|
|
|
const nodeStatusCodes = require('node-status-codes'); |
|
|
|
const isRetryAllowed = require('is-retry-allowed'); |
|
|
|
const pkg = require('./package'); |
|
|
|
|
|
|
@ -346,21 +345,21 @@ got.ReadError = createErrorClass('ReadError', stdError); |
|
|
|
got.ParseError = createErrorClass('ParseError', function (e, statusCode, opts, data) { |
|
|
|
stdError.call(this, e, opts); |
|
|
|
this.statusCode = statusCode; |
|
|
|
this.statusMessage = nodeStatusCodes[this.statusCode]; |
|
|
|
this.statusMessage = http.STATUS_CODES[this.statusCode]; |
|
|
|
this.message = `${e.message} in "${urlLib.format(opts)}": \n${data.slice(0, 77)}...`; |
|
|
|
}); |
|
|
|
|
|
|
|
got.HTTPError = createErrorClass('HTTPError', function (statusCode, opts) { |
|
|
|
stdError.call(this, {}, opts); |
|
|
|
this.statusCode = statusCode; |
|
|
|
this.statusMessage = nodeStatusCodes[this.statusCode]; |
|
|
|
this.statusMessage = http.STATUS_CODES[this.statusCode]; |
|
|
|
this.message = `Response code ${this.statusCode} (${this.statusMessage})`; |
|
|
|
}); |
|
|
|
|
|
|
|
got.MaxRedirectsError = createErrorClass('MaxRedirectsError', function (statusCode, opts) { |
|
|
|
stdError.call(this, {}, opts); |
|
|
|
this.statusCode = statusCode; |
|
|
|
this.statusMessage = nodeStatusCodes[this.statusCode]; |
|
|
|
this.statusMessage = http.STATUS_CODES[this.statusCode]; |
|
|
|
this.message = 'Redirected 10 times. Aborting.'; |
|
|
|
}); |
|
|
|
|
|
|
|