mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-04-23 03:12:10 +00:00
fix: better error logging for GraphQL
Signed-off-by: Florian BOUILLON <f.bouillon@aptatio.com>
This commit is contained in:
parent
f6e7871fc5
commit
0c29886812
@ -19,9 +19,14 @@ function graphQLErrorHandle(error: GraphQLError) {
|
||||
console.error(error)
|
||||
}
|
||||
if (error.source) {
|
||||
const columns = (process?.stdout?.columns ?? 32) - 7
|
||||
const dashes = ''.padEnd(columns / 2, '-')
|
||||
|
||||
console.error(`\x1b[91m${dashes} ERROR ${dashes}\x1b[0m`)
|
||||
console.error('GraphQL Error')
|
||||
console.error(error.message)
|
||||
console.error(error.source?.body.replace(/\n/g, '\\n'))
|
||||
console.error(error.source?.body)
|
||||
console.error(`\x1b[91m${dashes} ERROR ${dashes}\x1b[0m`)
|
||||
}
|
||||
return formatError(error)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user