Here is the code in question:
new Promise((resolve, reject) => {
  const opts = {
    credentials: 'same-origin',
  };
  fetch(`/_api/myAPI`, opts)
  .then((res) => {
    if (!res.ok) {
      reject(res);
    } else {
      ...
If the url throws an exception a 401, when the execution reaches reject(res); it throws Uncaught (in promise)
Even after I add a .catch after the .then call, i.e. 
  fetch(`/_api/myAPI`, opts)
  .then((res) => {
    if (!res.ok) {
      reject(res);
    } else {
      ...
   })
  .catch((e) => {
    console.log(e);
   }
it still happens.
Why reject will throw this exception and how can I fix it?  My experience is limited to  jQuery.Promise and I don't a reject within a failure handler will trigger this error. 
 
    