Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Commit

Permalink
Better error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Gardner committed Feb 25, 2019
1 parent 6dfe39e commit 98a07f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/tools/cleaner.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ const recurseReplaceBank = (obj, bank = {}) => {

if (shouldThrowTypeError) {
throw new TypeError(
[
'Cannot interpolate objects or arrays into a string.',
`You've sent an ${getObjectType(replacementValue)},`,
`which will get coerced to ${replacementValue}`
].join(' ')
`Cannot reliably interpolate objects or arrays into a string. We received an ${getObjectType(
replacementValue
)}:\n"${replacementValue}"`
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/create-request-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ describe('request client', () => {
message: 'No arrays, thank you: {{bundle.inputData.badData}}'
}
}).should.be.rejectedWith(
"Cannot interpolate objects or arrays into a string. You've sent an Array, which will get coerced to 1,2,3"
'Cannot reliably interpolate objects or arrays into a string. We received an Array:\n"1,2,3"'
);
});

Expand Down

0 comments on commit 98a07f5

Please sign in to comment.