mirror of
https://github.com/actions/hello-world-javascript-action.git
synced 2025-12-17 07:45:24 +00:00
Update packages, change to node16
This commit is contained in:
38
node_modules/@octokit/request-error/dist-node/index.js
generated
vendored
38
node_modules/@octokit/request-error/dist-node/index.js
generated
vendored
@@ -7,7 +7,8 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
||||
var deprecation = require('deprecation');
|
||||
var once = _interopDefault(require('once'));
|
||||
|
||||
const logOnce = once(deprecation => console.warn(deprecation));
|
||||
const logOnceCode = once(deprecation => console.warn(deprecation));
|
||||
const logOnceHeaders = once(deprecation => console.warn(deprecation));
|
||||
/**
|
||||
* Error with extra properties to help with debugging
|
||||
*/
|
||||
@@ -24,14 +25,17 @@ class RequestError extends Error {
|
||||
|
||||
this.name = "HttpError";
|
||||
this.status = statusCode;
|
||||
Object.defineProperty(this, "code", {
|
||||
get() {
|
||||
logOnce(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
|
||||
return statusCode;
|
||||
}
|
||||
let headers;
|
||||
|
||||
if ("headers" in options && typeof options.headers !== "undefined") {
|
||||
headers = options.headers;
|
||||
}
|
||||
|
||||
if ("response" in options) {
|
||||
this.response = options.response;
|
||||
headers = options.response.headers;
|
||||
} // redact request credentials without mutating original request options
|
||||
|
||||
});
|
||||
this.headers = options.headers; // redact request credentials without mutating original request options
|
||||
|
||||
const requestCopy = Object.assign({}, options.request);
|
||||
|
||||
@@ -46,9 +50,25 @@ class RequestError extends Error {
|
||||
.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]") // OAuth tokens can be passed as URL query parameters, although it is not recommended
|
||||
// see https://developer.github.com/v3/#oauth2-token-sent-in-a-header
|
||||
.replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
|
||||
this.request = requestCopy;
|
||||
this.request = requestCopy; // deprecations
|
||||
|
||||
Object.defineProperty(this, "code", {
|
||||
get() {
|
||||
logOnceCode(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
});
|
||||
Object.defineProperty(this, "headers", {
|
||||
get() {
|
||||
logOnceHeaders(new deprecation.Deprecation("[@octokit/request-error] `error.headers` is deprecated, use `error.response.headers`."));
|
||||
return headers || {};
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.RequestError = RequestError;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
Reference in New Issue
Block a user