cli: fix messages when receiving an error response

ogCLI displays a message like "Cannot connect to ogServer: [...]" when
ogServer replies with something different from 2XX.

Fix these strings because ogServer is actually connected and replying to
an ogCLI request.
master
Jose M. Guisado 2023-10-17 09:27:46 +02:00
parent 181075e505
commit 7c30d56910
1 changed files with 5 additions and 5 deletions

View File

@ -32,8 +32,8 @@ class OgREST():
headers=self.HEADERS,
json=payload)
if r.status_code != 200:
sys.exit(f"Cannot connect to ogServer: "
f"{r.status_code} HTTP status code")
sys.exit(f"Unsuccessful request to ogServer: "
f"Response with {r.status_code} HTTP status code")
except IOError as e:
sys.exit(f"Cannot connect to ogServer: {e}")
return r
@ -45,8 +45,8 @@ class OgREST():
json=payload)
print(r.text)
if r.status_code not in {200, 202}:
sys.exit(f"Cannot connect to ogServer: "
f"{r.status_code} HTTP status code")
sys.exit(f"Unsuccessful request to ogServer: "
f"Response with {r.status_code} HTTP status code")
except IOError as e:
sys.exit(f"Cannot connect to ogServer: {e}")
return r
@ -59,7 +59,7 @@ class OgREST():
print(r.text)
if r.status_code != 200:
sys.exit(f"Unsuccessful request to ogServer: "
f"{r.status_code} HTTP status code")
f"Response with {r.status_code} HTTP status code")
except IOError as e:
sys.exit(f"Cannot connect to ogServer: {e}")
return r