@octokit/request
Advanced tools
Comparing version 2.1.2 to 2.2.0
module.exports = class HttpError extends Error { | ||
constructor (message, statusCode, headers) { | ||
constructor (message, statusCode, headers, request) { | ||
super(message) | ||
@@ -20,3 +20,4 @@ | ||
this.headers = headers | ||
this.request = request | ||
} | ||
} |
@@ -43,3 +43,3 @@ 'use strict' | ||
throw new HttpError(response.statusText, status, headers) | ||
throw new HttpError(response.statusText, status, headers, requestOptions) | ||
} | ||
@@ -49,3 +49,3 @@ | ||
requestOptions.url = response.headers.location | ||
throw new HttpError('Not modified', status, headers) | ||
throw new HttpError('Not modified', status, headers, requestOptions) | ||
} | ||
@@ -57,3 +57,3 @@ | ||
.then(message => { | ||
const error = new HttpError(message, status, headers) | ||
const error = new HttpError(message, status, headers, requestOptions) | ||
@@ -95,4 +95,4 @@ try { | ||
throw new HttpError(error.message, 500, headers) | ||
throw new HttpError(error.message, 500, headers, requestOptions) | ||
}) | ||
} |
{ | ||
"name": "@octokit/request", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"publishConfig": { | ||
@@ -52,3 +52,2 @@ "access": "public" | ||
"mocha": "^5.2.0", | ||
"nock": "^10.0.1", | ||
"npm-run-all": "^4.1.3", | ||
@@ -58,3 +57,2 @@ "nyc": "^13.1.0", | ||
"simple-mock": "^0.8.0", | ||
"sinon-chai": "^3.2.0", | ||
"standard": "^12.0.1", | ||
@@ -61,0 +59,0 @@ "webpack": "^4.22.0", |
@@ -254,2 +254,8 @@ # request.js | ||
If an error occurs, the `error` instance has additional properties to help with debugging | ||
- `error.status` The http response status code | ||
- `error.headers` The http response headers as an object | ||
- `error.request` The request options such as `method`, `url` and `data` | ||
## `octokitRequest.defaults()` | ||
@@ -256,0 +262,0 @@ |
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
18703
15
123
380