0

Handling exceptions with Python x Oracle

I am new to Python development with Selenium. I need some clarification regarding Exceptions. In Oracle PL/SQL I was able to create a package, where I used to place all the procedures and functions related to error handling in my app. So, once a error occurs he is propagated from the inner part until being caught and handled by my API. Is it possible to work in similar way with Python? Although there are predefined exceptions, is there a way to raise them along my code with a IF statement and then follow my logic accordingly (like I do with Oracle), like "IF NoSuchElement (...)" or react whenever an specific error message occurs (like I do in Oracle)? I basically need to know how do I catch an exception in my code execution, how can I extract an error message presented at runtime to a variable to use as a log of a run, how can I accomplish to save the errors that are unhandled. Is there any best practices to work with exceptions?

22nd Jul 2020, 2:42 PM
Python newbie
1 Antwort