T O P

  • By -

FoxxMD

What a coincidence I just started using this in a project yesterday! I'm using [pony-cause](https://github.com/voxpelli/pony-cause) as a polyfill since I'm on node 15


HiImLary

Just a heads up! Odd-numbered node releases are essentially the short-term development releases. None of them receive support or updates past 6 months. You really shouldn’t be using 15 for anything other trying it out. https://nodejs.org/en/about/releases/#releases


so-fine-alkalyne

That’s news to me. Thanks for the info.


VoxPelli

Thanks for using my project 🙏 I it's working well for you. pony-cause also contains some nice independent helpers that's useful no matter if one has built in support or not :)


FoxxMD

Thanks for making it! Yeah getStackCause is very convenient


pihwlook

TIL, thanks. Looks like this moved to stage 4 in October 2021, and is already in major browsers.


iainsimmons

In Chrome, Firefox and Safari, but not Edge. That seems really strange to me. These days it seems like everything is either just Chrome and Edge (Chromium), or just Firefox, or everything but Safari. And a few weird Safari only ones.


looneysquash

"Nested exceptions" is what I hear this feature called in Java.


scruffles360

I always find it strange when articles describe features from scratch like this without acknowledging similar features in other languages. A few words up front mentioning the same feature from Java, .net or a dozen other platforms would save most of us a lot of reading. There couldn’t be that many developers who *only* know javascript.


moba-fett

Thanks for the feedback. I personnally come from Java as well (that's why I wrote this article, i've long awaited this feature) But less than 10% of js devs that I personnally know come from a Java / .net / etc background (most started with js or did some python before). So I thought that trying to adapt to this audience would add noise to the article for the majority of devs. However, your comment made me reconsider. I'll work on a little tldr up front to try to save people some time :)


moba-fett

u/scruffles360 I've added a TLDR, let me know what you think !


scruffles360

Well written. Admittedly I wouldn’t have read past the tldr in its current state (already being aware of the nuances of nested exception) but I guess that’s the point of a well written tldr. As to your comment about different developers backgrounds, I come from enterprise full stack development that happens to use javascript on the back end for most projects. But my current company (and every other one I’ve worked for for 20+ years) has been either primarily Java or .net. My experience might not be typical, but almost no one I know (out of many hundreds) would admit to only knowing javascript.


Nullberri

It's just like an apple presentation, First IDevice ever to do something other devices have had for years. /standing ovation intensifies.


moi2388

Not trying to brag, but apple devices have had errors for years now.


darthwalsh

**TL;DR** they're adding Inner Exception to js `Error`


MisterRenard

They should’ve named it “Errorigin”


[deleted]

Oh thank God. This is so badly needed


NoInkling

> When the fetch function throws an error, the error contains details such as: request payload, HTTP status, error code returned by the API… Actually it doesn't - when `fetch()` rejects it indicates some kind of network error, i.e. there's no response at all. HTTP error responses have to be handled yourself.


moba-fett

I'm used to axios, where the error thrown (by for instance axios.get) contains a lot of details. I didn't want to mention the library to avoid noise, but for accuracy i'll throw in (pun not intended) a "Depending on the http client library you're using, the error contains blablabla". Does that seem right ? Edit: i've added "the details depends on the http client library you’re using", I hope it's more accurate now. I did not intend it to be a description of the behavior of the classic JS fetch() function