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()
|
self.no_api_key()
|
||||||
return ""
|
return ""
|
||||||
elif response.status_code != 200:
|
elif response.status_code != 200:
|
||||||
|
try:
|
||||||
self.no_api_key(title=response.json()["error"])
|
self.no_api_key(title=response.json()["error"])
|
||||||
return ""
|
return ""
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
self.no_api_key(title="No response")
|
||||||
|
return ""
|
||||||
response = response.json()
|
response = response.json()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
except socket.gaierror:
|
except socket.gaierror:
|
||||||
self.no_connection()
|
self.no_connection()
|
||||||
return ""
|
return ""
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
self.no_api_key(title="No response")
|
||||||
|
return ""
|
||||||
else:
|
else:
|
||||||
self.hide_banner()
|
self.hide_banner()
|
||||||
if response:
|
if response:
|
||||||
|
Loading…
Reference in New Issue
Block a user