Skip to content

Commit 3bcf01d

Browse files
authored
output a slightly more helpful error message when we cannot download … (#5140)
* output a slightly more helpful error message when we cannot download bun installation script * add raises
1 parent 351ac2a commit 3bcf01d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

reflex/utils/prerequisites.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,12 +1134,20 @@ def download_and_run(url: str, *args, show_status: bool = False, **env):
11341134
args: The arguments to pass to the script.
11351135
show_status: Whether to show the status of the script.
11361136
env: The environment variables to use.
1137+
1138+
Raises:
1139+
Exit: If the script fails to download.
11371140
"""
11381141
# Download the script
11391142
console.debug(f"Downloading {url}")
1140-
response = net.get(url)
1141-
if response.status_code != httpx.codes.OK:
1143+
try:
1144+
response = net.get(url)
11421145
response.raise_for_status()
1146+
except httpx.HTTPError as e:
1147+
console.error(
1148+
f"Failed to download bun install script. You can install or update bun manually from https://bun.sh \n{e}"
1149+
)
1150+
raise typer.Exit(1) from None
11431151

11441152
# Save the script to a temporary file.
11451153
script = Path(tempfile.NamedTemporaryFile().name)

0 commit comments

Comments
 (0)