Skip to content

Commit beb79f0

Browse files
committed
fix: log errors properly
1 parent 9f9fd69 commit beb79f0

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/app.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ export function getApp(env: Env) {
4040
},
4141
});
4242

43-
app.webhooks.on('issue_comment.created', async (data) => {
44-
logger.debug('in comment create');
43+
// eslint-disable-next-line promise/prefer-await-to-callbacks
44+
app.webhooks.onError((err) => {
45+
logger.error({ err }, 'Webhook error');
46+
});
47+
48+
// TODO: Swap to create for prod
49+
app.webhooks.on('issue_comment.edited', async (data) => {
50+
logger.debug('in comment edit');
4551

4652
if (!data.payload.comment.body.startsWith('pack this')) {
4753
logger.debug(`Comment does not start with 'pack this': ${data.payload.comment.body}`);

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const server = {
4444
headers: { 'content-type': 'application/json' },
4545
});
4646
} catch (error) {
47-
logger.error({ error }, 'Error processing webhook');
47+
logger.error({ err: error }, 'Error processing webhook');
4848
return new Response('internal server error', {
4949
status: 500,
5050
headers: { 'content-type': 'application/json' },

0 commit comments

Comments
 (0)