First upload version 0.0.1
This commit is contained in:
21
node_modules/@octokit/request-error/LICENSE
generated
vendored
Normal file
21
node_modules/@octokit/request-error/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
93
node_modules/@octokit/request-error/README.md
generated
vendored
Normal file
93
node_modules/@octokit/request-error/README.md
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
# request-error.js
|
||||
|
||||
> Error class for Octokit request errors
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/request-error)
|
||||
[](https://github.com/octokit/request-error.js/actions?query=workflow%3ATest)
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
Load <code>@octokit/request-error</code> directly from <a href="https://esm.sh">esm.sh</a>
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { RequestError } from "https://esm.sh/@octokit/request-error";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/request-error</code>
|
||||
|
||||
```js
|
||||
import { RequestError } from "@octokit/request-error";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
> [!IMPORTANT]
|
||||
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json` by setting `"moduleResolution": "node16", "module": "node16"`.
|
||||
>
|
||||
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
|
||||
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
|
||||
|
||||
```js
|
||||
const error = new RequestError("Oops", 500, {
|
||||
request: {
|
||||
method: "POST",
|
||||
url: "https://api.github.com/foo",
|
||||
body: {
|
||||
bar: "baz",
|
||||
},
|
||||
headers: {
|
||||
authorization: "token secret123",
|
||||
},
|
||||
},
|
||||
response: {
|
||||
status: 500,
|
||||
url: "https://api.github.com/foo",
|
||||
headers: {
|
||||
"x-github-request-id": "1:2:3:4",
|
||||
},
|
||||
data: {
|
||||
foo: "bar",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
error.message; // Oops
|
||||
error.status; // 500
|
||||
error.request; // { method, url, headers, body }
|
||||
error.response; // { url, status, headers, data }
|
||||
```
|
||||
|
||||
### Usage with Octokit
|
||||
|
||||
```js
|
||||
try {
|
||||
// your code here that sends at least one Octokit request
|
||||
await octokit.request("GET /");
|
||||
} catch (error) {
|
||||
// Octokit errors always have a `error.status` property which is the http response code
|
||||
if (error.status) {
|
||||
// handle Octokit error
|
||||
} else {
|
||||
// handle all other errors
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
[MIT](LICENSE)
|
||||
41
node_modules/@octokit/request-error/dist-src/index.js
generated
vendored
Normal file
41
node_modules/@octokit/request-error/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
class RequestError extends Error {
|
||||
name;
|
||||
/**
|
||||
* http status code
|
||||
*/
|
||||
status;
|
||||
/**
|
||||
* Request options that lead to the error.
|
||||
*/
|
||||
request;
|
||||
/**
|
||||
* Response object if a response was received
|
||||
*/
|
||||
response;
|
||||
constructor(message, statusCode, options) {
|
||||
super(message, { cause: options.cause });
|
||||
this.name = "HttpError";
|
||||
this.status = Number.parseInt(statusCode);
|
||||
if (Number.isNaN(this.status)) {
|
||||
this.status = 0;
|
||||
}
|
||||
/* v8 ignore else -- @preserve -- Bug with vitest coverage where it sees an else branch that doesn't exist */
|
||||
if ("response" in options) {
|
||||
this.response = options.response;
|
||||
}
|
||||
const requestCopy = Object.assign({}, options.request);
|
||||
if (options.request.headers.authorization) {
|
||||
requestCopy.headers = Object.assign({}, options.request.headers, {
|
||||
authorization: options.request.headers.authorization.replace(
|
||||
/(?<! ) .*$/,
|
||||
" [REDACTED]"
|
||||
)
|
||||
});
|
||||
}
|
||||
requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
|
||||
this.request = requestCopy;
|
||||
}
|
||||
}
|
||||
export {
|
||||
RequestError
|
||||
};
|
||||
21
node_modules/@octokit/request-error/dist-types/index.d.ts
generated
vendored
Normal file
21
node_modules/@octokit/request-error/dist-types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { RequestOptions, OctokitResponse } from "@octokit/types";
|
||||
import type { RequestErrorOptions } from "./types.js";
|
||||
/**
|
||||
* Error with extra properties to help with debugging
|
||||
*/
|
||||
export declare class RequestError extends Error {
|
||||
name: "HttpError";
|
||||
/**
|
||||
* http status code
|
||||
*/
|
||||
status: number;
|
||||
/**
|
||||
* Request options that lead to the error.
|
||||
*/
|
||||
request: RequestOptions;
|
||||
/**
|
||||
* Response object if a response was received
|
||||
*/
|
||||
response?: OctokitResponse<unknown> | undefined;
|
||||
constructor(message: string, statusCode: number, options: RequestErrorOptions);
|
||||
}
|
||||
5
node_modules/@octokit/request-error/dist-types/types.d.ts
generated
vendored
Normal file
5
node_modules/@octokit/request-error/dist-types/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { RequestOptions, OctokitResponse } from "@octokit/types";
|
||||
export interface RequestErrorOptions extends ErrorOptions {
|
||||
response?: OctokitResponse<unknown> | undefined;
|
||||
request: RequestOptions;
|
||||
}
|
||||
50
node_modules/@octokit/request-error/package.json
generated
vendored
Normal file
50
node_modules/@octokit/request-error/package.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "@octokit/request-error",
|
||||
"version": "7.1.0",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"type": "module",
|
||||
"description": "Error class for Octokit request errors",
|
||||
"repository": "github:octokit/request-error.js",
|
||||
"keywords": [
|
||||
"octokit",
|
||||
"github",
|
||||
"api",
|
||||
"error"
|
||||
],
|
||||
"author": "Gregor Martynus (https://github.com/gr2m)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/tsconfig": "^4.0.0",
|
||||
"@types/node": "^24.0.0",
|
||||
"@vitest/coverage-v8": "^4.0.0",
|
||||
"esbuild": "^0.27.0",
|
||||
"glob": "^11.0.0",
|
||||
"prettier": "3.6.2",
|
||||
"tinybench": "^5.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"vitest": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20"
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**",
|
||||
"bin/**"
|
||||
],
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"import": "./dist-src/index.js",
|
||||
"default": "./dist-src/index.js"
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"unpkg": "dist-src/index.js"
|
||||
}
|
||||
Reference in New Issue
Block a user