budibase/packages/backend-core/src/logging.js

17 lines
388 B
JavaScript
Raw Normal View History

2022-05-31 11:16:22 +02:00
const NonErrors = ["AccountError"]
function isSuppressed(e) {
return e && e["suppressAlert"]
}
module.exports.logAlert = (message, e = null) => {
2022-05-31 11:16:22 +02:00
if (e && NonErrors.includes(e.name) && isSuppressed(e)) {
return
}
let errorJson = ""
if (e) {
errorJson = ": " + JSON.stringify(e, Object.getOwnPropertyNames(e))
}
console.error(`bb-alert: ${message} ${errorJson}`)
}