Make github issues about your nodejs errors!!
npm install gh-error
# or
pnpm add gh-error
# or
yarn add gh-errorrPretty shrimple, one could say.
import { ErrorHandler } from "gh-error";
const handler = new ErrorHandler({
ghPat: process.env.GH_PAT, // GitHub personal access token (required)
// Optional: auto-detected from git if not provided
repoOwner: "your-username",
repoName: "your-repo",
});
// Bind to process errors (uncaughtException, unhandledRejection)
handler.bindToErrors();
// Or handle errors manually
try {
throw new Error("Something went wrong!");
} catch (e) {
await handler.handleError(e);
}Set your GitHub PAT in your environment:
GH_PAT=ghp_your_token_hereWhen an error occurs, gh-error will:
- Create a GitHub issue with the error details and a Mermaid diagram
- If the same error occurs again, it comments on the existing issue
- If a closed issue matches the error, it reopens it
Issues are tagged with automated-error and bug labels.