You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library documentation refers to a few articles about how exceptions might be used in controlling the control flow of an application. This is an interesting topic to explore further.
I personally very much like to write exceptions as dataclasses and inherit them from DocumentedError. This allows me to encapsulate business logic related information in those exceptions, and then to easily retrieve it in other parts of the application. For instance, I can do something like this:
In this question, we do not provide user_name to the internal layer of the application which is responsible for communication with HAL9000 computer, but we catch the error, enhance it with information available in the API layer, and reraise. Voilà.
Also
ExceptionList, a new feature introduced into Python recently, can be mentioned in relation to this topic.
When?
No idea; perhaps at some point I get inspired by a particular usage example and will get to writing this piece.
The text was updated successfully, but these errors were encountered:
The library documentation refers to a few articles about how exceptions might be used in controlling the control flow of an application. This is an interesting topic to explore further.
I personally very much like to write exceptions as
dataclasses
and inherit them fromDocumentedError
. This allows me to encapsulate business logic related information in those exceptions, and then to easily retrieve it in other parts of the application. For instance, I can do something like this:In this question, we do not provide
user_name
to the internal layer of the application which is responsible for communication with HAL9000 computer, but we catch the error, enhance it with information available in the API layer, and reraise. Voilà.Also
ExceptionList
, a new feature introduced into Python recently, can be mentioned in relation to this topic.When?
No idea; perhaps at some point I get inspired by a particular usage example and will get to writing this piece.
The text was updated successfully, but these errors were encountered: