diff --git a/CHANGELOG.md b/CHANGELOG.md index d896f8495..356bca9b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed false positive warning in `layout_columns()` about number of widths vs elements. (#1704) +* When errors occur in a bookmarking context, they are now reported in the Python console. (#2076) + ### Bug fixes * Fixed numerous issues related to programmatically updating selectize options. (#2053) diff --git a/shiny/bookmark/_bookmark.py b/shiny/bookmark/_bookmark.py index bcff1d523..4150198c7 100644 --- a/shiny/bookmark/_bookmark.py +++ b/shiny/bookmark/_bookmark.py @@ -558,15 +558,10 @@ async def do_bookmark(self) -> None: await self.show_bookmark_url_modal(full_url) except Exception as e: - msg = f"Error bookmarking state: {e}" - from ..ui._notification import notification_show - - notification_show( - msg, - duration=None, - type="error", - session=self._root_session, - ) + from ..types import NotifyException + + msg = f"Error bookmarking state: {str(e)}" + raise NotifyException(msg) from e class BookmarkProxy(Bookmark): diff --git a/shiny/reactive/_reactives.py b/shiny/reactive/_reactives.py index c509d0809..3b38a0762 100644 --- a/shiny/reactive/_reactives.py +++ b/shiny/reactive/_reactives.py @@ -597,9 +597,10 @@ async def _run(self) -> None: from ..ui import notification_show msg = str(e) + warnings.warn(msg, ReactiveWarning, stacklevel=2) if e.sanitize: msg = SANITIZE_ERROR_MSG - notification_show(msg, type="error", duration=5000) + notification_show(msg, type="error", duration=None) if e.close: await self._session._unhandled_error(e) except Exception as e: