Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js fetch catch 401

 fetch("some-url")
    .then(function(response)
     {
      if(response.status!==200)
       {
          throw new Error(response.status)
       }
     })
    .catch(function(error)
    {
      ///if status code 401...
    });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #fetch #catch
ADD COMMENT
Topic
Name
8+3 =