mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-04-23 03:12:10 +00:00
feat: Add more error loggin to catch this shitty error
Signed-off-by: Florian BOUILLON <f.bouillon@aptatio.com>
This commit is contained in:
parent
e6a8c1dd71
commit
8e3406f8fc
@ -1,5 +1,5 @@
|
|||||||
import Sentry from '@sentry/node'
|
import Sentry from '@sentry/node'
|
||||||
import express from 'express'
|
import express, { NextFunction } from 'express'
|
||||||
import jsonEndpoints from './V2/endpoints/jsonEndpoints'
|
import jsonEndpoints from './V2/endpoints/jsonEndpoints'
|
||||||
import graphql from './V2/graphql'
|
import graphql from './V2/graphql'
|
||||||
import status from './status'
|
import status from './status'
|
||||||
@ -86,6 +86,20 @@ if (sentryDSN) {
|
|||||||
server.use(Sentry.Handlers.errorHandler())
|
server.use(Sentry.Handlers.errorHandler())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// error logging to the backend
|
||||||
|
server.use((err: Error, _1: any, _2: any, next: NextFunction) => {
|
||||||
|
// add a full line dash to not miss it
|
||||||
|
const columns = (process?.stdout?.columns ?? 32) - 7
|
||||||
|
const dashes = ''.padEnd(columns / 2, '-')
|
||||||
|
|
||||||
|
// colorize the lines to make sur to not miss it
|
||||||
|
console.error(`\x1b[91m${dashes} ERROR ${dashes}\x1b[0m`)
|
||||||
|
console.error(err)
|
||||||
|
console.error(`\x1b[91m${dashes} ERROR ${dashes}\x1b[0m`)
|
||||||
|
|
||||||
|
next(err)
|
||||||
|
})
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
server.listen(3000)
|
server.listen(3000)
|
||||||
console.log(`🚀 Server ready at localhost:3000`);
|
console.log(`🚀 Server ready at localhost:3000`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user