-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blows up in confusing way if Discord is down #417
Comments
Thanks for the report! I'm partial to the second option - moving away from |
Yeah, I'm not sure. It's probably entirely reasonable to still just raise an exception and die, just with a more helpful message (like Having the |
So Discord went down for a bit, and I started getting this error while trying to start my bot:
(Note that the error was actually on line 195 in stock, the
Jason.decode!
line — it's just that I had added aFile.write("/tmp/response", body)
line to see what was happening.)It's certainly entirely reasonable for Nostrum to refuse to start up while Discord is down, but the error message could be a lot better — this makes it look like there's some protocol-level error, when the error is just that I'm getting an HTML page (a stock
502 Bad Gateway
page) instead of a JSON page.I'd submit a PR, but I'm not sure how best to fix this. There's at least a couple options here:
content-type
of the reply, to ensure it'sapplication/json
Jason.decode
(rather thandecode!
) and handle the{:error, err}
case specially.The text was updated successfully, but these errors were encountered: