UNPKG

probot

Version:

A framework for building GitHub Apps to automate and improve your workflow

31 lines (30 loc) • 1.41 kB
export function getErrorHandler(log) { return (error) => { const errors = error instanceof AggregateError ? error.errors : [error]; const event = error.event; for (const error of errors) { const errMessage = (error instanceof Error ? error.message : typeof error === "object" && error !== null && "message" in error && typeof error.message === "string" ? error.message : String(error) || "").toLowerCase(); if (errMessage.includes("x-hub-signature-256")) { log.error(error, "Go to https://github.com/settings/apps/YOUR_APP and verify that the Webhook secret matches the value of the WEBHOOK_SECRET environment variable."); continue; } if (errMessage.includes("pem") || errMessage.includes("json web token")) { log.error(error, "Your private key (a .pem file or PRIVATE_KEY environment variable) or APP_ID is incorrect. Go to https://github.com/settings/apps/YOUR_APP, verify that APP_ID is set correctly, and generate a new PEM file if necessary."); continue; } log .child({ name: "event", id: event?.id, }) .error(error); } }; }