Skip to content

feat: add sentry logging #13

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

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const loadProbot = appFn => {
probot = probot || createProbot({
id: process.env.APP_ID,
secret: process.env.WEBHOOK_SECRET,
webhookProxy: process.env.WEBHOOK_PROXY_URL,
cert: findPrivateKey()
})

Expand Down Expand Up @@ -50,7 +51,6 @@ module.exports.serverless = appFn => {
// Do the thing
console.log(`Received event ${e}${event.body.action ? ('.' + event.body.action) : ''}`)
if (event) {
try {
await probot.receive({
name: e,
payload: event.body
Expand All @@ -62,20 +62,8 @@ module.exports.serverless = appFn => {
})
}
return context.done(null, res)
} catch (err) {
console.error(err)
return context.done(null, {
statusCode: 500,
body: JSON.stringify(err)
})
}
} else {
console.error({ event, context })
context.done(null, 'unknown error')
throw new Error(`Unknown Error, No event ${context}`)
}
return context.done(null, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

un used code path

statusCode: 200,
body: 'Nothing to do.'
})
}
}