SomeoneElse37 / BattleBot

A Discord bot that rolls dice and stuff.
MIT License
0 stars 1 forks source link

nicer errors #5

Open lenscas opened 7 years ago

lenscas commented 7 years ago

right now, a lot of errors just give stack traces in the discord chat (including from my own command). We should probably make some nicer errors?

SomeoneElse37 commented 7 years ago

Yeah, this isn't a bad idea. I like having the stacktraces there when I'm writing code, because they help me locate bugs.

That said, nobody else can look at a stack trace and say "Oh, you probably put an extra space in there somewhere". So it might be a good idea to have the bot look at the exception it catches and make a guess as to why it was thrown, and append a line to the message giving the user a suggestion as to what went wrong. If it's an error caused by an unreadable command, it could tell the user how that command is supposed to be used.

lenscas commented 7 years ago

or print the stacktrace to the console and give a nicer message to the user or if not possible a generic "something went wrong" message?

Maybe have a debug function similar to def debug(str,debugNum): if debugNum<=CONFIG_DEBUG_MODE: print(str) to limit the amount of stuff that gets printed to the console? As I wouldn't be surprised if most stuff we print this way don't need to be displayed unless you are actually trying to debug something

lenscas commented 7 years ago

going to make a list of known errors that should be made nicer along with the current error they throw. (not the entire stack trace)