Small code cleanup

(imported from commit d9f09e5a9b33be0b23ddae072a3021bb01a3de3e)
This commit is contained in:
Zev Benjamin 2013-04-04 15:18:54 -04:00
parent c65f37c910
commit b7cd8db139

View File

@ -92,21 +92,21 @@ exports.wrap_function = function blueslip_wrap_function(func) {
var new_func = function blueslip_wrapper() {
if (page_params.debug_mode) {
return func.apply(this, arguments);
} else {
try {
return func.apply(this, arguments);
} catch (ex) {
// Treat exceptions like a call to fatal()
var message = ex.message;
if (ex.hasOwnProperty('fileName')) {
message += " at " + ex.fileName;
if (ex.hasOwnProperty('lineNumber')) {
message += ":" + ex.lineNumber;
}
}
try {
return func.apply(this, arguments);
} catch (ex) {
// Treat exceptions like a call to fatal()
var message = ex.message;
if (ex.hasOwnProperty('fileName')) {
message += " at " + ex.fileName;
if (ex.hasOwnProperty('lineNumber')) {
message += ":" + ex.lineNumber;
}
report_error(message, ex.stack, {show_ui_msg: true});
throw ex;
}
report_error(message, ex.stack, {show_ui_msg: true});
throw ex;
}
};
func.blueslip_wrapper = new_func;