plotly / plotly/dash

[Feature Request] Optionally pass errors raised from a callback specific error handler to the global error handler

Open
#3,036 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Thanks so much for your interest in Dash!

Before posting an issue here, please check the Dash community forum to see if the topic has already been discussed. The community forum is also great for implementation questions. When in doubt, please feel free to just post the issue here :)

Is your feature request related to a problem? Please describe.
Currently if I define on_error for both the Dash() class and a for a specific callback, the callback specific on_error overwrites the global on_error. It would be nice to have an option to chain these error handlers, so that exceptions raised from the callback specific on_error are passed on to the global on_error.

Example I can think of:

  • callback specific on_error: handles user incorrectly filling in data
  • global on_error: catches unexpected errors (ie. bugs) and notifies the developer

Describe the solution you'd like
Perhaps a bool argument to the callback() decorator that would enable passing uncaught exceptions from the local on_error to the global on_error, and the same argument to the Dash() class which would be used as a default for all callbacks?

Describe alternatives you've considered

  • Wrapping callback specific on_error in a try catch block and calling the global error handler manually.
  • Wrapping the body of a callback in a try catch block and calling the callback specific on_error manually.
    I think both of these approaches are unnecessary boiler plate.

Additional context
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Dash() class and callback() decorator entry points described in the issue, then trace how their on_error handlers are selected and invoked. Review existing error-handler tests, if present, and define the behavior for optionally passing exceptions from a callback-specific handler to the global handler, including the application-level default.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.