From 26baaab34cdb7822ae13a733598c3429e50da3d7 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 3 Apr 2020 14:26:59 +0000 Subject: [PATCH] zblueslip: Expect strings in blueslip calls. --- frontend_tests/zjsunit/zblueslip.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend_tests/zjsunit/zblueslip.js b/frontend_tests/zjsunit/zblueslip.js index bd24a77e6f..36be2d012b 100644 --- a/frontend_tests/zjsunit/zblueslip.js +++ b/frontend_tests/zjsunit/zblueslip.js @@ -49,10 +49,18 @@ exports.make_zblueslip = function () { return; } lib[name] = function (message, more_info, stack) { + if (typeof message !== 'string') { + // We may catch exceptions in blueslip, and if + // so our stub should include that. + if (message.toString().includes('exception')) { + message = message.toString(); + } else { + throw Error('message should be string: ' + message); + } + } lib.test_logs[name].push({message, more_info, stack}); const exact_match_fail = !lib.test_data[name].includes(message); - const string_match_fail = !lib.test_data[name].includes(message.toString()); - if (exact_match_fail && string_match_fail) { + if (exact_match_fail) { const error = Error(`Invalid ${name} message: "${message}".`); error.blueslip = true; throw error;