5 ms·
It actually does handle errors properly -- the reddit api is probably blocked for you, which is why it hangs and can't do anything. I suppose I could have added
by thesephist 6y ago
It actually does handle errors properly -- the reddit api is probably blocked for you, which is why it hangs and can't do anything. I suppose I could have added a "it seems we can't reach Reddit" kind of message, but that would still have been an error state, and in rushing this out in an afternoon it wasn't much of a priority.
Didn't realize until posting here that apparently Firefox blocks the reddit api from the browser in certain common configurations. So maybe that would have been useful.
- thih9 6y ago> It actually does handle errors properly IMO if a website displays a loading message indefinitely then this isn’t error handling. I’d say that showing accurate feedback is part of proper error handling; like the one you suggested: > I suppose I could have added a "it seems we can't reach Reddit" kind of message, Not that a hobby project needs error handling, it’s cool even without it.
- StrangeSound 6y agoIt doesn't load for me in Chrome either. In the function fetchRedditStories, it looks like that the callback param in the catch is named `e`, but it tries to log `error`. Checking the network panel I'm getting a 200, but I'm pretty sure it's failing anyway because of the ReferenceError
- thesephist 6y agoDarn, can't believe I didn't catch that typo until now. I don't think that was the issue -- unbound variables don't cause exceptions in JS until that variable is dereferenced -- but not sure what else it could be if the reddit api hit is succeeding with a 200. Maybe a wonky JSON Decode?
- eitland 6y ago> Darn, can't believe I didn't catch that typo until now. I don't think that was the issue -- unbound variables don't cause exceptions in JS until that variable is dereferenced The underlying problem here is using Javascript instead of TypeScript. And of course under that problem there's the problem of Javascript bit being TypeScript in the first place. (Not a bad word about Brendan Eich though, considering that the language was created by one man in three weeks it is amazing, but it is still sad that we ended up with an untyped language in such a critical place.)
- jfkebwjsbx 6y agoHanging or crashing without feedback is pretty much "not handling errors".