fix: handle json decode error
This commit is contained in:
parent
e36e58c1c8
commit
85fc78a222
@ -36,14 +36,21 @@ class StableDiffusionLocalProvider(ImaginerProvider):
|
||||
self.no_api_key()
|
||||
return ""
|
||||
elif response.status_code != 200:
|
||||
try:
|
||||
self.no_api_key(title=response.json()["error"])
|
||||
return ""
|
||||
except json.decoder.JSONDecodeError:
|
||||
self.no_api_key(title="No response")
|
||||
return ""
|
||||
response = response.json()
|
||||
except KeyError:
|
||||
pass
|
||||
except socket.gaierror:
|
||||
self.no_connection()
|
||||
return ""
|
||||
except json.decoder.JSONDecodeError:
|
||||
self.no_api_key(title="No response")
|
||||
return ""
|
||||
else:
|
||||
self.hide_banner()
|
||||
if response:
|
||||
|
Loading…
Reference in New Issue
Block a user