Discord-Scraper icon indicating copy to clipboard operation
Discord-Scraper copied to clipboard

Error messages showing up in multiples when scraping multiple channels per guild.

Open Dracovian opened this issue 4 years ago • 1 comments

This is likely due to the fact that I haven't forced the script to swallow exceptions in the function named handleNetworkData in the main script file.

I'll keep debugging the script until I have this issue fixed on the next commit.

Dracovian avatar Apr 23 '20 15:04 Dracovian

Okay I did discover why this is occurring and I feel pretty dumb for overlooking this...

NetworkException is a child of CustomException which is a child of Exception By the rule of inheritance, NetworkException is considered a child of Exception

So whenever I did something like this:

try:
    raise NetworkException(...)

except NetworkException as nex:
    stderr.write(nex.getMessage())

except Exception as ex:
    raise RuntimeException(...) from ex

except RuntimeException as rex:
    stderr.write(rex.getMessage())

I ended up potentially having three error messages show up per error. So the solution here is to break the inheritance between NetworkException and Exception.

Dracovian avatar Apr 23 '20 16:04 Dracovian