diff --git a/lib/chai-as-promised.js b/lib/chai-as-promised.js index 0b84194..a10f892 100644 --- a/lib/chai-as-promised.js +++ b/lib/chai-as-promised.js @@ -77,7 +77,17 @@ module.exports = (chai, utils) => { } function getReasonName(reason) { - return reason instanceof Error ? reason.toString() : checkError.getConstructorName(reason); + const constructorName = checkError.getConstructorName(reason); + const message = checkError.getMessage(reason); + + if (reason instanceof Error) { + return reason.toString(); + } else if (constructorName instanceof String) { + return constructorName; + } else if (message instanceof String) { + return message; + } + return reason; } // Grab these first, before we modify `Assertion.prototype`.