Merge pull request #13014 from Budibase/log-js-errors-properly
Log js errors properly
This commit is contained in:
commit
52d0207d30
|
@ -103,6 +103,7 @@
|
||||||
"pouchdb-all-dbs": "1.1.1",
|
"pouchdb-all-dbs": "1.1.1",
|
||||||
"pouchdb-find": "7.2.2",
|
"pouchdb-find": "7.2.2",
|
||||||
"redis": "4",
|
"redis": "4",
|
||||||
|
"serialize-error": "^7.0.1",
|
||||||
"server-destroy": "1.0.1",
|
"server-destroy": "1.0.1",
|
||||||
"snowflake-promise": "^4.5.0",
|
"snowflake-promise": "^4.5.0",
|
||||||
"socket.io": "4.6.1",
|
"socket.io": "4.6.1",
|
||||||
|
|
|
@ -3,6 +3,7 @@ import env from "../environment"
|
||||||
import { setJSRunner, setOnErrorLog } from "@budibase/string-templates"
|
import { setJSRunner, setOnErrorLog } from "@budibase/string-templates"
|
||||||
import { context, logging, timers } from "@budibase/backend-core"
|
import { context, logging, timers } from "@budibase/backend-core"
|
||||||
import tracer from "dd-trace"
|
import tracer from "dd-trace"
|
||||||
|
import { serializeError } from "serialize-error"
|
||||||
|
|
||||||
type TrackerFn = <T>(f: () => T) => T
|
type TrackerFn = <T>(f: () => T) => T
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ export function init() {
|
||||||
|
|
||||||
if (env.LOG_JS_ERRORS) {
|
if (env.LOG_JS_ERRORS) {
|
||||||
setOnErrorLog((error: Error) => {
|
setOnErrorLog((error: Error) => {
|
||||||
logging.logWarn(JSON.stringify(error))
|
logging.logWarn(JSON.stringify(serializeError(error)))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue