Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

zblueslip: Show chained causes in unexpected messages.

Alex Vandiver5d97dbf8b3a5
diff --git a/web/tests/lib/zblueslip.js b/web/tests/lib/zblueslip.js
index 28135178d99..28caaad675d 100644
--- a/web/tests/lib/zblueslip.js
+++ b/web/tests/lib/zblueslip.js
@@ -85,12 +85,12 @@ function make_zblueslip() {
for (const name of names) {
if (!opts[name]) {
// should just log the message.
- lib[name] = function (message, more_info, stack) {
- lib.test_logs[name].push({message, more_info, stack});
+ lib[name] = function (message, more_info, cause) {
+ lib.test_logs[name].push({message, more_info, cause});
};
continue;
}
- lib[name] = function (message, more_info, stack) {
+ lib[name] = function (message, more_info, cause) {
/* istanbul ignore if */
if (typeof message !== "string") {
// We may catch exceptions in blueslip, and if
@@ -101,12 +101,16 @@ function make_zblueslip() {
throw new Error("message should be string: " + message);
}
}
- lib.test_logs[name].push({message, more_info, stack});
+ lib.test_logs[name].push({message, more_info, cause});
const matched_error_message = lib.test_data[name].find((x) => x.message === message);
const exact_match_fail = !matched_error_message;
if (exact_match_fail) {
const error = new Error(`Invalid ${name} message: "${message}".`);
error.blueslip = true;
+ /* istanbul ignore if */
+ if (cause !== undefined) {
+ error.cause = cause;
+ }
throw error;
}
};