Skip to content

Commit

Permalink
Detailed error message for wasm_utils.get_registered_app() (#7572)
Browse files Browse the repository at this point in the history
* Detailed error message for wasm_utils.get_registered_app()

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
  • Loading branch information
3 people committed Mar 18, 2024
1 parent f67759d commit 7d3c868
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/major-results-stick.md
@@ -0,0 +1,5 @@
---
"gradio": minor
---

feat:Detailed error message for wasm_utils.get_registered_app()
11 changes: 10 additions & 1 deletion gradio/wasm_utils.py
Expand Up @@ -46,5 +46,14 @@ def register_app(_app):
app_map[app_id] = _app


class GradioAppNotFoundError(Exception):
pass


def get_registered_app(app_id: str):
return app_map[app_id]
try:
return app_map[app_id]
except KeyError as e:
raise GradioAppNotFoundError(
f"Gradio app not found (ID: {app_id}). Forgot to call demo.launch()?"
) from e

0 comments on commit 7d3c868

Please sign in to comment.