sartography / spiff-arena

SpiffWorkflow is a software development platform for building, running, and monitoring executable diagrams
https://www.spiffworkflow.org/
GNU Lesser General Public License v2.1
53 stars 38 forks source link

Make sure connector logs errors #1619

Open burnettk opened 2 months ago

burnettk commented 2 months ago

Jakub saw a thing where he introduced a KeyError in logging code in connector. The service task in backend saw the key error but connector itself did not log it.

jakubgs commented 1 month ago

I read a bit about flask error handling and it seems to me like it's standard behavior for it to just return exceptions via responses:

When an error occurs in Flask, an appropriate HTTP status code will be returned. 400-499 indicate errors with the client’s request data, or about the data requested. 500-599 indicate errors with the server or application itself.

https://flask.palletsprojects.com/en/3.0.x/errorhandling/#error-handlers

jakubgs commented 1 month ago

It is possible that we need to write a custom error handler that doesn't modify the request response but does log the exception: https://flask.palletsprojects.com/en/3.0.x/api/#flask.Flask.errorhandler

Something like:

    @app.errorhandler(Exception)
    def exception(err):
        app.logger.exception(err)
        return err