diff --git a/src/api.js b/src/api.js index 6a95093..28b00c9 100644 --- a/src/api.js +++ b/src/api.js @@ -546,11 +546,15 @@ var remoteAuthentication = function(options, entry) { '', 'You have the scopes:', '', + '```', '{{scopes}}', + '```', '', 'This request requires you to satisfy this scope expression:', '', + '```', '{{required}}', + '```', ].join('\n'); err.details = { scopes: result.scopes, diff --git a/src/errors.js b/src/errors.js index ff3b29d..f23ae0e 100644 --- a/src/errors.js +++ b/src/errors.js @@ -61,7 +61,7 @@ let BuildReportErrorMethod = (method, errorCodes, monitor, cleanPayload) => { message = message.replace(/{{([a-zA-Z0-9_-]+)}}/g, (text, key) => { let value = details.hasOwnProperty(key) ? details[key] : text; if (typeof value !== 'string') { - return JSON.stringify(value, null, 2); + value = JSON.stringify(value, null, 2); } // escape the substituted value, so that the markdown rendering cannot be abused value = escapeMarkdown(value); diff --git a/test/errors_test.js b/test/errors_test.js index 47bca4c..94df41a 100644 --- a/test/errors_test.js +++ b/test/errors_test.js @@ -65,15 +65,15 @@ suite('api/errors', function() { let response = JSON.parse(res.response.text); response.message = response.message.replace(response.requestInfo.time, ''); response.requestInfo.time = ''; - assert(_.isEqual(response, { + assert.deepEqual(response, { code: 'TooManyFoos', message: [ 'You can only have 3 foos. These foos already exist:', - '[', + '\\[', ' 1,', ' 2,', ' 3', - ']', + '\\]', '----', 'method: toomanyfoos', 'errorCode: TooManyFoos', @@ -86,7 +86,7 @@ suite('api/errors', function() { payload: {foos: [4, 5]}, time: '', }, - })); + }); }); });