Comparing version 1.2.0 to 1.2.1
@@ -6,2 +6,3 @@ 'use strict'; | ||
}); | ||
exports.HTTPError = undefined; | ||
@@ -193,11 +194,3 @@ var _util = require('util'); | ||
}; | ||
this.HTTPError = class HTTPError extends Error { | ||
constructor(http, body) { | ||
body = `\n${_util2.default.inspect(body)}`; | ||
super(`HTTP Error ${http.response.statusCode} for ${http.method} ${http.url}${body}`); | ||
this.statusCode = http.response.statusCode; | ||
} | ||
}; | ||
if (!url) throw new Error('no url provided'); | ||
@@ -224,3 +217,3 @@ this.options = options; | ||
if (!this.raw) this.body = await this.parse(this.response); | ||
} else throw new this.HTTPError(this, (await this.parse(this.response))); | ||
} else throw new HTTPError(this, (await this.parse(this.response))); | ||
} | ||
@@ -258,4 +251,16 @@ | ||
} | ||
} | ||
exports.default = HTTP; | ||
class HTTPError extends Error { | ||
constructor(http, body) { | ||
let message; | ||
if (typeof body === 'string' || typeof body.message === 'string') message = body.message || body;else message = _util2.default.inspect(body); | ||
super(`HTTP Error ${http.response.statusCode} for ${http.method} ${http.url}\n${message}`); | ||
this.statusCode = http.response.statusCode; | ||
this.http = http; | ||
this.body = body; | ||
} | ||
} | ||
exports.default = HTTP; | ||
exports.HTTPError = HTTPError; |
{ | ||
"name": "http-call", | ||
"description": "make http requests", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": "Jeff Dickey @dickeyxxx", | ||
"bugs": "https://github.com/dickeyxxx/http-call/issues", | ||
"dependencies": { | ||
"debug": "^2.x", | ||
"debug": "^2.6.8", | ||
"tunnel-agent": "^0.6.0" | ||
@@ -10,0 +10,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20767
301
Updateddebug@^2.6.8