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 }
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; } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4