Even in Java / C #, the exception class, RuntimeError is not marked and will not be detected by the compiler (therefore they are called RuntimeError not CompileError).
In python, some exceptions, such as KeyboardInterrupt, are especially hairy, as they can be raised at almost any arbitrary point in the program.
I am looking for something more than porting my code with a big try.
Nothing but this, please. It is much better to let exceptions access the user and stop the program, rather than skipping the error silently (Zen of Python).
Unlike Java, Python does not require all Exceptions to be caught, because the requirement that all Exceptions be caught makes it too easy for programmers to ignore the Exception (by writing an empty exception handler).
Just relax, let the mistake stop; let the user report this to you so that you can fix it. Another alternative is that you go to the debugger within forty-two hours because the client data is corrupted everywhere because of the empty mandatory exception handler.
So, what you need to change in your methodology, think that the exception is bad; they are not beautiful, but they are better than alternatives.
source share