samedi 27 juin 2020

Usefullness of Python Transformer Exception Pattern?

I was reading up on the various error-handling patterns and I came across the so-called "Transformer" pattern. It's exemplified as such:

try:
    something()
except SomeError as err:
    logger.warn("...")
    raise DifferentError() from err

Why would you want to do this? Why not just use DifferentError from the start? An example of this being needed may help.

Aucun commentaire:

Enregistrer un commentaire