I have lots of callbacks split out into different python files and I want to use a global callback error handler as defined here. I want to be able to show a generic alert or popup to the user whenever an error happens, but without having to change any of my existing callbacks in any way.
Is it possible to define the global callback error handler function in a separate file and return the alert e.g.
def global_error_handler(err):
# do error handling stuff here
return html.Div([dbc.Alert("An error happened", id="alert-fade", dismissable=True, is_open=True)])
I tried this, but obviously it is expecting the objects defined in the Output of the callback which encountered the exception:
dash._grouping.SchemaTypeValidationError: Schema:
...
...
...
Expected type: (<class 'tuple'>, <class 'list'>)
Received value of type <class 'dash.html.Div.Div'>:
Div([Alert(children='An error happened', id='alert-fade', dismissable=True, is_open=True)])
How do I override this to display my alert without modifying all of my callbacks?