make-error-cause icon indicating copy to clipboard operation
make-error-cause copied to clipboard

Could `toString()` show causes?

Open garyo opened this issue 5 years ago • 2 comments

I have to remember to import fullStack and use it when logging errors. It would be convenient if make-error-cause would override Error.prototype.toString() to print the causes as well. Perhaps that's considered too much of a change from the standard Error behavior?

garyo avatar Jun 26 '20 01:06 garyo

Do you want it to also include the stack trace or is this just the message strings? If so, I think it's possible. But adding the stack would mean a deviation from standard Error.prototype.toString that I don't want to introduce.

blakeembrey avatar Jun 26 '20 03:06 blakeembrey

Also for (self) reference, V1 did this but I removed it: https://github.com/blakeembrey/make-error-cause/commit/6de32aba29c0ca0e095a2f893fb7166a700347d5. I believe there was an issue with ES2015 overwriting toString, but I really wish I had written the reasoning down in a PR now. I can try it out and come back to you.

blakeembrey avatar Jun 26 '20 03:06 blakeembrey