Closed dineshbvadhia closed 3 months ago
Hey! You should handle errors using standard try-except in any place where it's suitable for your application, then you can wrap the raised exception in an Err()
instance and return it.
The @catch
decorator does this for you as a convenience feature, if you'd like to handle exceptions of any type then you can use @catch(Exception)
or even @catch(BaseException)
, although the latter is usually not recommended.
This is not an Issue but two related usage questions. For my system, it is necessary to capture unexpected errors as exceptions. These should bubble up and be logged (with structlog) and the system will exit. How does poltergeist handle unexpected errors in a general way?
Secondly, in the examples, say:
The expected error is stated as
OSError
. But what if, the expected error is not known in advance (or alternatively, the expected errors are left out deliberately to see what errors are generated)?