Merge pull request #13014 from Budibase/log-js-errors-properly

Log js errors properly
This commit is contained in:
Adria Navarro 2024-02-12 16:27:30 +01:00 committed by GitHub
commit 52d0207d30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -103,6 +103,7 @@
"pouchdb-all-dbs": "1.1.1",
"pouchdb-find": "7.2.2",
"redis": "4",
"serialize-error": "^7.0.1",
"server-destroy": "1.0.1",
"snowflake-promise": "^4.5.0",
"socket.io": "4.6.1",

View File

@ -3,6 +3,7 @@ import env from "../environment"
import { setJSRunner, setOnErrorLog } from "@budibase/string-templates"
import { context, logging, timers } from "@budibase/backend-core"
import tracer from "dd-trace"
import { serializeError } from "serialize-error"
type TrackerFn = <T>(f: () => T) => T
@ -61,7 +62,7 @@ export function init() {
if (env.LOG_JS_ERRORS) {
setOnErrorLog((error: Error) => {
logging.logWarn(JSON.stringify(error))
logging.logWarn(JSON.stringify(serializeError(error)))
})
}
}