Skip to content

Commit 8120ddc

Browse files
geckguyrmorshea
andauthored
Better Error message if no backend installed #1042 (#1045)
* 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 <[email protected]> * fix linting issues * Update src/py/reactpy/reactpy/backend/default.py Co-authored-by: Ryan Morshead <[email protected]> * Improve readability * Update src/py/reactpy/reactpy/backend/default.py * make text bold --------- Co-authored-by: Ryan Morshead <[email protected]>
1 parent f559e23 commit 8120ddc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/py/reactpy/reactpy/backend/default.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Any, NoReturn
77

88
from reactpy.backend.types import BackendImplementation
9-
from reactpy.backend.utils import all_implementations
9+
from reactpy.backend.utils import SUPPORTED_PACKAGES, all_implementations
1010
from reactpy.types import RootComponentConstructor
1111

1212
logger = getLogger(__name__)
@@ -59,7 +59,13 @@ def _default_implementation() -> BackendImplementation[Any]:
5959
implementation = next(all_implementations())
6060
except StopIteration: # nocov
6161
logger.debug("Backend implementation import failed", exc_info=exc_info())
62-
msg = "No built-in server implementation installed."
62+
supported_backends = ", ".join(SUPPORTED_PACKAGES)
63+
msg = (
64+
"It seems you haven't installed a backend. To resolve this issue, "
65+
"you can install a backend by running:\n\n"
66+
'\033[1mpip install "reactpy[starlette]"\033[0m\n\n'
67+
f"Other supported backends include: {supported_backends}."
68+
)
6369
raise RuntimeError(msg) from None
6470
else:
6571
_DEFAULT_IMPLEMENTATION = implementation

0 commit comments

Comments
 (0)