mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
The new system, called blueslip, makes errors fatal when in debug mode and only output a message when running in production. In the future, it could also send user errors back to us automatically. (imported from commit 1232607c0311e885c8b5a5e8a45ffb28822426e0)
39 lines
677 B
JavaScript
39 lines
677 B
JavaScript
// Silence jslint errors about the "console" global
|
|
/*global console: true */
|
|
|
|
var blueslip = (function () {
|
|
|
|
var exports = {};
|
|
|
|
exports.log = function blueslip_log (msg) {
|
|
console.log(msg);
|
|
};
|
|
|
|
exports.info = function blueslip_info (msg) {
|
|
console.info(msg);
|
|
};
|
|
|
|
exports.warn = function blueslip_warn (msg) {
|
|
console.warn(msg);
|
|
if (debug_mode) {
|
|
console.trace();
|
|
}
|
|
};
|
|
|
|
exports.error = function blueslip_error (msg) {
|
|
if (debug_mode) {
|
|
throw new Error(msg);
|
|
} else {
|
|
console.error(msg);
|
|
}
|
|
};
|
|
|
|
exports.fatal = function blueslip_fatal (msg) {
|
|
throw new Error(msg);
|
|
};
|
|
|
|
return exports;
|
|
}());
|
|
|
|
/*global console: false */
|