Skip to content
RED SAGSkills
easy5 pts · first answer countsapi-designhttp-clientjavascript

fetch treats a 404 as success

This code never reaches the catch block when the API returns 404. Why?

try {
  const res = await fetch('/api/orders/9')
  const order = await res.json()
  show(order)
} catch (e) {
  showError(e)
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions