Skip to content

Commit

Permalink
[Class statistics] Capture the full stack trace of errors instead of …
Browse files Browse the repository at this point in the history
…creating a new one
  • Loading branch information
valtterikantanen committed Nov 6, 2024
1 parent 361d5da commit fe25985
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions services/backend/src/routes/population.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ router.post('/v2/populationstatistics/courses', async (req: PostPopulationStatis
try {
const result = await bottlenecksOf(query, null, encrypted)
return res.json(result)
} catch (error: any) {
Sentry.captureException(new Error(error.message))
} catch (error: unknown) {
if (error instanceof Error) {
Sentry.captureException(error)
}
return res.status(400).end()
}
})
Expand Down Expand Up @@ -156,8 +158,10 @@ router.post(
studentNumberList
)
return res.json(result)
} catch (error: any) {
Sentry.captureException(new Error(error.message))
} catch (error: unknown) {
if (error instanceof Error) {
Sentry.captureException(error)
}
return res.status(400).end()
}
}
Expand Down Expand Up @@ -200,8 +204,10 @@ router.post(
studentNumbers
)
return res.json(result)
} catch (error: any) {
Sentry.captureException(new Error(error.message))
} catch (error: unknown) {
if (error instanceof Error) {
Sentry.captureException(error)
}
return res.status(400).end()
}
}
Expand Down

0 comments on commit fe25985

Please sign in to comment.