# Send user warning messages on Python error

**URL:** <https://discourse.bokeh.org/t/send-user-warning-messages-on-python-error/6750>\
**Category:** Community Support\
**Created:** [November 18, 2020, 3:17pm UTC](https://discourse.bokeh.org/t/send-user-warning-messages-on-python-error/6750 "2020-11-18T15:17:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![efremdan1](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/e/73ab20/32.png) [@efremdan1](https://discourse.bokeh.org/u/efremdan1)\
**Post date:** [November 18, 2020, 3:17pm UTC](https://discourse.bokeh.org/t/send-user-warning-messages-on-python-error/6750/1 "2020-11-18T15:17:24Z")

</div>

I’m wondering if there’s a built-in default method to send warning messages to the user when they do something wrong. For example, in my example, the user needs to load in a certain kind of file using the FileInput; if the file is formatted improperly, my Python code will throw an exception with the message “Improperly formatted file”. I want to catch this exception and display something to the user that says “Improperly formatted file”.

I saw bokeh.core.validation and bokeh.util.warning, but I’m not sure what exactly these do and whether they’re are meant for my use case. If I should be using them, I’m not so sure how I’d implement them. Would they go in the callback method called by FileInput.on\_change()? How so?

Or do I need to build my own tool for this, e.g., put in an invisible Div at the top of the page that I send a callback to whenever I catch an error?

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [November 18, 2020, 3:21pm UTC](https://discourse.bokeh.org/t/send-user-warning-messages-on-python-error/6750/2 "2020-11-18T15:21:23Z")

</div>

> [@efremdan1](#):
>
> Or do I need to build my own tool for this, e.g., put in an invisible Div at the top of the page that I send a callback to whenever I catch an error?

This is the best solution. The modules you mention are internal utilities for the library itself, and not useful for users.

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [July 21, 2021, 9:29pm UTC](https://discourse.bokeh.org/t/send-user-warning-messages-on-python-error/6750/3 "2021-07-21T21:29:56Z")

</div>


