Closed nbrownus closed 11 years ago
err.description
not standart property. It is not used neither Error
nor AssertionError
. So what is idea to add it to error?
The original code appends the custom message to the end of the error message, adding a pipe. If an error is thrown and it contains a custom message there is no elegant way to get just that message.
Mocha, for example, does not print the error message if a diff can be shown. This leads to the custom message never being printed. If there was a reliable way to get the custom message Mocha could print this along with the diff, which is what I have done in a fork.
So you mean that mocha can use err.description
?
Or any other project that consumes errors thrown by should.js
Hm, it does not look that mocha use this field. In any case i am ok with this PR, i will test and merge tomorrow to v2 (for 2.0.0). 2.0.0 probably will be available at the end of week or monday.
Mocha does not currently, if/when this PR get's merged I will do a PR to Mocha to use the field.
Appreciate the help!
I merged this pr, but release date moved to future in 2 weeks i think.
The main goal of this pull request is to add the custom message to the error object so that it can be referenced without doing string manipulation on the error message itself (splitting at the pipe).
I also did some doc fixing and whatnot