Cory
Mar 24, 2022

--

```

.catch(value => {

if (value instanceof Error) throw value

return value

})

```

😂

I had debated including nearly exactly that code, but chose not to so as to try and keep the conversation on point, but yeah. Sometimes I use as special rejection object and narrow how I handle it in the last catch. I think that's a holdover from when I first learned try/catch and it was customary to interrogate the error type and handle it differently depending on what error was thrown. In any case, like I said, it's not something that comes up all that often.

--

--

Cory
Cory

Written by Cory

Front End Engineer with deep technical expertise in JS, CSS, React, Frontend Architecture, and lots more. I lean functional, but I focus on maintainability.

No responses yet