Black Lives Matter. Please consider donating to Black Girls Code today.

Is it possible to throw exceptions to generate modal dialog on the UI?

Hi All,

Let me preface this question with an explanation - yes, it can be done by setting up a Modal window and having multiple Output which triggers the Modal window to be displayed. But it seems very “non-pythonic”.

Is it possible to implement a custom exception class with some layout/message attribute fields so that we can inject a window pop-up when this custom exception is thrown?

We know this is already done in Dash internally since exceptions in the callback functions are caught and propagated to the UI via the developer tools in the bottom-right corner.