Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Error message if no backend installed #1042 #1045

Merged
merged 8 commits into from
Jun 13, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/py/reactpy/reactpy/backend/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, NoReturn

from reactpy.backend.types import BackendImplementation
from reactpy.backend.utils import all_implementations
from reactpy.backend.utils import SUPPORTED_PACKAGES, all_implementations
from reactpy.types import RootComponentConstructor

logger = getLogger(__name__)
Expand Down Expand Up @@ -59,7 +59,12 @@ def _default_implementation() -> BackendImplementation[Any]:
implementation = next(all_implementations())
except StopIteration: # nocov
logger.debug("Backend implementation import failed", exc_info=exc_info())
msg = "No built-in server implementation installed."
supported_backends = ", ".join(SUPPORTED_PACKAGES)
msg = ("It seems you haven't installed a backend. To resolve this issue, "
"you can install a backend by running:\n\n"
'pip install "reactpy[starlette]"\n\n'
f"Other supported backends include: {supported_backends}.")
geckguy marked this conversation as resolved.
Show resolved Hide resolved

raise RuntimeError(msg) from None
else:
_DEFAULT_IMPLEMENTATION = implementation
Expand Down