Skip to main content

Error handling

  • By default http-pro throws an error if response.status is not between 200 and 299.


note

http-pro throws a custom Error called HttpProError when statucCode is not valid. you can check if given error is HttpProError or not by using isHttpProError function.


Custom-error handling

  • If you want to customize the default behaviour of error logic, you can use validateStatus property of httpOptions. it will get statusCode as an arguement and it needs to return boolean, if function returns true it will not throw an Error otherwise it will.