You're not handling errors. You're hiding them.
Every app crashes. Every API fails. Every database hiccups at 2am on a Friday.
The difference between a good dev and a great one? What happens next.
Let's roast your error handling — then make it legendary.
🤦 Level 0: The "Trust Me Bro" Dev
No try/catch at all. Just vibes.
const data = await fetchUserData(userId);
console.log(data.profile.name); // 💥 TypeError: Cannot read properties of undefined
The crime: One bad response nukes the entire app. Users see a white screen. You get a 3am Slack ping.
🐣 Level 1: The Junior — "I Googled try/catch"
try {
const data = await fetchUserData(userId);
setUser(data);
} catch (err) {
console.log(err); // 👈 and... that's it. shipped.
}
What's wrong here?
console.login production helps nobody — users still see a broken UI- No distinction between a 404 and a 500 — every error is treated the same
- The error disappears into the void (or a DevTools tab nobody has open)
errmight benull, a string, or anErrorobject — you're not checking
The mindset: "At least it won't crash." — Yeah, it just silently breaks instead. Cool.
SOCIAL SHARE CARD GENERATOR