procrastinate
procrastinate copied to clipboard
Add error message context to failure
When a job/task fails the logs contain what happened, but often you want to add a error message/explanation as part of the log
Is there a way to do this?
At first glance it would seem a json col in the events table would work and allow submitting "context" info as part of the job attempt/fail
Thanks
https://procrastinate.readthedocs.io/en/stable/howto/production/logging.html#make-the-most-out-of-the-logging-system
Does the above section help?
In the case of a failed job, there would be an exc_info atttribute in the extra field that holds the caught exception.
Another way is to define a middleware and catch/re-raise exceptions there.
At first glance it would seem a json col in the events table would work and allow submitting "context" info as part of the job attempt/fail
I can see how it would be useful to have error context persisted for failed job events.
I think it would make sense to have that if we also have task results (which would make sense if we had workflows).
It might be worth revisiting the whole thing, but I think this needs a design decision for the vision of Procrastinate before we make it a thing especially since that can be implemented as user code.