catch 404, display error message

PHOTO EMBED

Mon Jul 31 2023 21:24:41 GMT+0000 (Coordinated Universal Time)

Saved by @thecowsays #react.js

.catch(err => {
  console.log(err.response.status)
  if (err.response.status === 404) {
    alert(`No results matching ${query}`)
  }
  else {
    console.log(err)
  }
})
content_copyCOPY

used in process of an API call to return any 404 errors from a failed searchbox query to the user