Nested functions exception handling
Last updated
Was this helpful?
Last updated
Was this helpful?
Original question asked in Real Python slack group:
I have a question about chained exception handling method and how to return except conditions when I use it for one function which relies on another function. The code can be found below for more context: It looks to me from answers I got from experienced folks in Real python, there are two ways to do this:
In main function write try/except code and raise the exception from nested inner function
Hello this is my rewriten code which required a custom class in Python:
py
class ModelNotSupported(Exception):
pass
This can be be implemented with a function which returns messages, and based on which return based on the conditions.