typicode/fetchival

401 Unauthorized does not get handled by .catch

Closed this issue · 1 comments

kr094 commented

A 401 unauthorized throws an exception from JS and cannot be handled with a .catch().

Steps to reproduce:

  1. fetchival('api.php').then(...).catch(function (error) { console.log(error); });
  2. Have server return a 401
  3. Exception: index.min.js:1 Uncaught (in promise) Error: Unauthorized
    at index.min.js:1
    at
  4. catch block is never called

Browser:
Chrome 63.0.3239.132 (Official Build) (64-bit)
Fetchival latest pulled from https://github.com/typicode/fetchival/blob/master/index.min.js yesterday