Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please provide context as part of the onError callback #1716

Closed
trammel opened this issue Aug 12, 2022 · 3 comments
Closed

Please provide context as part of the onError callback #1716

trammel opened this issue Aug 12, 2022 · 3 comments

Comments

@trammel
Copy link

trammel commented Aug 12, 2022

Feature Request

When setting an error handler, it'd be very useful to know the context and payload that caused the issue. This can then be logged, along with the error.

import { Probot } from "probot";
import { WebhookEventHandlerError } from "@octokit/webhooks/dist-types/types";

export = (app: Probot) => {
    app.onError(async (error: WebhookEventHandlerError) => {
        app.log(error);
        // app.log(context.payload)
    });
};

I believe this used to be possible, when using the creating webhooks named "*" and "error", but those were deprecated in favour of #1480

@welcome
Copy link

welcome bot commented Aug 12, 2022

Thanks for opening this issue. A contributor should be by to give feedback soon. In the meantime, please check out the contributing guidelines and explore other ways you can get involved.

@AaronDewes
Copy link
Member

AaronDewes commented Aug 12, 2022

https://github.com/octokit/webhooks.js#webhooksonerror

The handler is called with an error object that has a .event property which has all the information on the event: {id, name, payload}.

You can already access the payload there currently

GitHub
GitHub webhook events toolset for Node.js. Contribute to octokit/webhooks.js development by creating an account on GitHub.

@trammel
Copy link
Author

trammel commented Aug 12, 2022

https://github.com/octokit/webhooks.js#webhooksonerror

The handler is called with an error object that has a .event property which has all the information on the event: {id, name, payload}.

You can already access the payload there currently

Oh thank you. I missed that in the documentation.

GitHub
GitHub webhook events toolset for Node.js. Contribute to octokit/webhooks.js development by creating an account on GitHub.

@trammel trammel closed this as completed Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants