mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-04-22 10:52:10 +00:00
chore: Add error reporting (#617)
* chore: Add error reporting Signed-off-by: Avior <git@avior.me> * fix: test issues Signed-off-by: Avior <git@avior.me> --------- Signed-off-by: Avior <git@avior.me>
This commit is contained in:
parent
0616b98038
commit
87d9b16fb8
@ -19,5 +19,5 @@ params:query {
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body: length 85
|
||||
res.body.length: gt 85
|
||||
}
|
||||
|
@ -17,5 +17,5 @@ params:query {
|
||||
|
||||
assert {
|
||||
res.status: eq 200
|
||||
res.body.length: lt 0
|
||||
res.body.length: gte 6
|
||||
}
|
||||
|
2
server/.gitignore
vendored
2
server/.gitignore
vendored
@ -4,3 +4,5 @@
|
||||
/public/**/graphql.gql
|
||||
/public/**/api.d.ts
|
||||
/public/**/openapi.yaml
|
||||
.env
|
||||
.env.*
|
||||
|
BIN
server/bun.lockb
BIN
server/bun.lockb
Binary file not shown.
@ -13,6 +13,7 @@
|
||||
"@dzeio/config": "^1",
|
||||
"@dzeio/object-util": "^1",
|
||||
"@dzeio/queue": "^1",
|
||||
"@sentry/node": "^8",
|
||||
"@tcgdex/sdk": "^2",
|
||||
"apicache": "^1",
|
||||
"express": "^4",
|
||||
|
@ -5,6 +5,13 @@ import { Errors, sendError } from './libs/Errors'
|
||||
import status from './status'
|
||||
import jsonEndpoints from './V2/endpoints/jsonEndpoints'
|
||||
import graphql from './V2/graphql'
|
||||
import * as Sentry from "@sentry/node"
|
||||
|
||||
// Glitchtip will only start if the DSN is set :D
|
||||
Sentry.init({
|
||||
dsn: process.env.GLITCHTIP_DSN,
|
||||
environment: process.env.NODE_ENV
|
||||
})
|
||||
|
||||
if (cluster.isPrimary) {
|
||||
console.log(`Primary ${process.pid} is running`)
|
||||
@ -107,7 +114,8 @@ if (cluster.isPrimary) {
|
||||
sendError(Errors.NOT_FOUND, res)
|
||||
})
|
||||
|
||||
// General error handler
|
||||
// Error handlers
|
||||
Sentry.setupExpressErrorHandler(server)
|
||||
server.use((err: Error, _1: unknown, res: Response, _2: unknown) => {
|
||||
// add a full line dash to not miss it
|
||||
const columns = (process?.stdout?.columns ?? 32) - 7
|
||||
|
Loading…
x
Reference in New Issue
Block a user