Detailed error message for wasm_utils.get_registered_app() (#7572)

* 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>
This commit is contained in:
Yuichiro Tachibana (Tsuchiya) 2024-03-18 23:35:24 +09:00 committed by GitHub
parent f67759dcee
commit 7d3c868d0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": minor
---
feat:Detailed error message for wasm_utils.get_registered_app()

View File

@ -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