My learning diary

Don't catch everything

I did a catch when I didn’t need to. I defined the catch clause for an API request which should return a rejected Promise upon failure. As a result, the toast which indicated failure didn’t appear.

In this commit, I removed the catch clause.

And in another commit, I defined what failure is.

While writing about this, I wondered if there could be a better way to express identical requirements. A quick search led me to this Stack Overflow thread - throw (but not in AngularJS).

Relevant posts