Telling users about an error

Hi, I have a problem which I’m sure that many other people are facing as well.

Let’s take a simple example: we have a dropdown with countries which is an input to a callback while the output is some chart. User selects first country and the plot displays. But then after choosing another country there is some date-related error and the callback fails. This means that the plot remains the same (belongs to country 1) but the value in the dropdown is country 2 which can be very confusing for users.

Because this is a common problem I was thinking if there is some nice common solution for such problems (maybe even a built in function?). Of course I can add some output Div to the callback and use try-except but this can become messy with more callbacks (and more complicated ones). I’ve found a similar topic from many years ago where the suggested solution was something similar. So I’m trying my luck if there is some newer and nicer solution to this problem. Any Ideas?

1 Like

Hi @Lucho7 you mean like if you run your app wit debug=True but presented in a different way?

1 Like

Hello @Lucho7,

Unfortunately, there isn’t a smooth way to do this.

I believe that this may be in scope of some of the things plotly wants to do.

Right now, there are too many things that could cause issues. For example, knowing what info to be presented back to the user, what things should reset, etc.

Example, you disable a button upon click, the button never gets reenabled, you add a notification, the notification never disappears. XD

However, there might be a way to add something on the clientside if a fetch fails for a callback.

1 Like