From f16eb88eabaff34d615a67f6a0f3bdc32d7312ed Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Mon, 26 Jun 2023 09:18:26 +0200 Subject: [PATCH] Catch json decode error --- scripts/knotctl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/knotctl b/scripts/knotctl index b6e3e0a..0182804 100755 --- a/scripts/knotctl +++ b/scripts/knotctl @@ -313,6 +313,10 @@ def main() -> int: except KeyError: output(response.json()) return 1 + except json.JSONDecodeError: + output( + error("Could not decode api response as JSON", "Could not decode")) + return 1 headers = {"Authorization": "Bearer {}".format(token)} # Route based on command