Skip to content

Commit 69fbed6

Browse files
committed
feat: Handle connection errors
fixes : mpflash: Improve HTTP error handling #562
1 parent 989fd3b commit 69fbed6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/mpflash/mpflash/download.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,5 +290,10 @@ def download(
290290
except (PermissionError, FileNotFoundError) as e:
291291
log.critical(f"Could not create folder {destination}")
292292
raise MPFlashError(f"Could not create folder {destination}") from e
293+
try:
294+
result = download_firmwares(destination, ports, boards, versions, force=force, clean=clean)
295+
except requests.exceptions.RequestException as e:
296+
log.exception(e)
297+
raise MPFlashError("Could not connect to micropython.org") from e
293298

294-
return download_firmwares(destination, ports, boards, versions, force=force, clean=clean)
299+
return result

0 commit comments

Comments
 (0)