Is your feature request related to a problem? Please describe.
https://github.com/octokit/octokit.js?tab=readme-ov-file#request-error-handling
import { RequestError } from "octokit";
try {
// your code here that sends at least one Octokit request
await octokit.request("GET /");
} catch (error) {
// Octokit errors are instances of RequestError, so they always have an `error.status` property containing the HTTP response code.
if (error instanceof RequestError) {
// handle Octokit error
// error.message; // Oops
// error.status; // 500
// error.request; // { method, url, headers, body }
// error.response; // { url, status, headers, data }
} else {
// handle all other errors
throw error;
}
}
Scripts don't have access to the RequestError class, making error handling a pain.
Describe the solution you'd like
Expose RequestError to the script.
Describe alternatives you've considered
You can skip the instanceof check and access the attribute directly (e.g. error.status) but this is approach is very imprecise and error-prone.