Thinking About Exception Chaining And Error Reporting In JavaScript
CRANK

CAUTION: This post is just me trying to talk though a problem. This is basically a stream-of-consciousness post. Thar be dragons.In the past, I've written about "Russian Doll" error reporting in Node.js, which requires creating custom Error objects in JavaScript (which can, of course, be done in TypeScript as well). But, just because I've noodled on the topic in the past, it doesn't mean that I am confident in how to use it. In fact, just the opposite - while I love the idea of exception chaining, I have almost no confidence in how to use it effectively. As such, I thought I might try to "talk it out" and step through my confusion. Maybe something good will come of it. Maybe someone will have some helpful feedback.One of the few places that I've seen an in-depth discussion on exception chaining is in the book, Elegant Objects by Yegor Bugayenko. In Elegant Objects, Yegor proposes that exception chaining should just be done as a matter of course:I'm sure this is just obvious, but let m…

bennadel.com
Related Topics: JavaScript AltJS Node.js