PROGRAMMING
JavaScript
Practical tutorials for the work we actually do. Pick one, read it in order, and apply it.
0 likes
Likes for this tutorial.
fetch With Proper Error Handling (It Doesn't Throw on 404)
Level: Intermediate
fetch only rejects when there's no response. A 404 or 500 resolves normally, so check response.ok, add a timeout, and keep the status on the error so the caller can decide what to tell the user.
5 min read
0 likes
Likes for this tutorial.
Fix "Unexpected token in JSON" Errors
Level: Intermediate
"Unexpected token in JSON" means JSON.parse got text that isn't JSON. Read the exact message, log the raw text, and match it to one of five causes. Most of the time it's an HTML error or login page.
5 min read