UNPKG

probot

Version:

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

24 lines (23 loc) 1.12 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.message || "").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); } }; }