* 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>
This commit is contained in:
parent
f559e230dc
commit
8120ddc228
1 changed files with 8 additions and 2 deletions
|
@ -6,7 +6,7 @@ from sys import exc_info
|
|||
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__)
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue