Skip to content

Commit

Permalink
Better Error message if no backend installed #1042 (#1045)
Browse files Browse the repository at this point in the history
* Better Error message if no backend installed #1042

* change the error message as requested

* Update src/py/reactpy/reactpy/backend/default.py

Co-authored-by: Ryan Morshead <ryan.morshead@gmail.com>

* fix linting issues

* Update src/py/reactpy/reactpy/backend/default.py

Co-authored-by: Ryan Morshead <ryan.morshead@gmail.com>

* Improve readability

* Update src/py/reactpy/reactpy/backend/default.py

* make text bold

---------

Co-authored-by: Ryan Morshead <ryan.morshead@gmail.com>
  • Loading branch information
geckguy and rmorshea authored Jun 13, 2023
1 parent f559e23 commit 8120ddc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 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,13 @@ 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"
'\033[1mpip install "reactpy[starlette]"\033[0m\n\n'
f"Other supported backends include: {supported_backends}."
)
raise RuntimeError(msg) from None
else:
_DEFAULT_IMPLEMENTATION = implementation
Expand Down

0 comments on commit 8120ddc

Please sign in to comment.