Interview practice question
fetch doesn't throw on a 404 error
Frontend Engineering · Async JavaScript and the Browser · Beginner
Your code wraps fetch in try/catch, but a 404 response doesn't trigger the catch block. Why, and how do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- fetch resolves for HTTP errors.
- Check response.ok/status.
- Throw custom error.
- Shared request helper.
- Handle network errors separately.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.