From 297108393a0fb5841208daf6edf909f1d1b57602 Mon Sep 17 00:00:00 2001 From: nlscc <66028747+nlscc@users.noreply.github.com> Date: Tue, 22 Feb 2022 00:17:58 +0000 Subject: add error when device or model is invalid (checkupdate) --- samloader/versionfetch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/samloader/versionfetch.py b/samloader/versionfetch.py index e758867..58ea186 100644 --- a/samloader/versionfetch.py +++ b/samloader/versionfetch.py @@ -19,9 +19,11 @@ def getlatestver(model: str, region: str) -> str: """ Get the latest firmware version code for a model and region. """ req = requests.get("https://fota-cloud-dn.ospserver.net/firmware/" \ + region + "/" + model + "/version.xml") + if req.status_code == 403: + raise Exception("Model or region not found (403)") req.raise_for_status() root = ET.fromstring(req.text) vercode = root.find("./firmware/version/latest").text if vercode is None: - raise Exception("No latest firmware found") + raise Exception("No latest firmware available") return normalizevercode(vercode) -- cgit v1.2.3