JamesDevJim / game-zulu

First game of the coolest project
0 stars 1 forks source link

Bare exception clauses #11

Open shuttle1987 opened 4 years ago

shuttle1987 commented 4 years ago

In general it's rather dangerous to catch all exceptions and the behavior that occurs when you don't specify an exception is that it catches everything.

https://github.com/JamesDevJim/game-zulu/blob/9bf97d92194ff8e7d61785aa535806c37a14003a/shared/control.py#L90

So this catches all exceptions raised in the try block. Try to not use this form of exception handling if you can. If you can't avoid it you probably want to do:

except Exception as ex:

Since this doesn't catch some exceptions that you almost certainly do not want to catch and lets you log the exception via ex.