2022-05-31 11:16:22 +02:00
|
|
|
const NonErrors = ["AccountError"]
|
|
|
|
|
|
|
|
function isSuppressed(e) {
|
|
|
|
return e && e["suppressAlert"]
|
|
|
|
}
|
|
|
|
|
2022-07-06 14:36:29 +02:00
|
|
|
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}`)
|
|
|
|
}
|