added better error handling when failure to connect to server

This commit is contained in:
Phixxy 2024-02-11 14:34:28 -08:00
parent e906b9da1d
commit b421166b23

View file

@ -226,7 +226,8 @@ class StableDiffusion(commands.Cog):
r = await resp.json() r = await resp.json()
except Exception as error: except Exception as error:
await ctx.send("My image generation service may not be running.") await ctx.send("My image generation service may not be running.")
self.bot.logger.exception("Error in imagine") self.bot.logger.exception("Error with connection to image generation service")
return
for i in r['images']: for i in r['images']:
image = Image.open(io.BytesIO(base64.b64decode(i.split(",", 1)[0]))) image = Image.open(io.BytesIO(base64.b64decode(i.split(",", 1)[0])))