show an error instead of crashing when galtinn can't be reached in register and delete
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28a61b42a1
commit
7d782690c5
1 file changed
+8
@@ -617,6 +617,10 @@ class Galtinn(commands.Cog):
|
||||
|
||||
# Check if user is already registered
|
||||
discord_profile = await self.fetch_galtinn_discordprofiles(discord_id=interaction.user.id)
|
||||
if discord_profile is None:
|
||||
embed = embed_templates.error_fatal("Klarte ikke å hente data fra Galtinn. Prøv igjen senere!")
|
||||
await interaction.followup.send(embed=embed)
|
||||
return
|
||||
# API guarantees that there is only one or zero results so this is safe
|
||||
if discord_profile.count == 1:
|
||||
embed = embed_templates.error_warning("Du er allerede registrert!")
|
||||
@@ -690,6 +694,10 @@ class Galtinn(commands.Cog):
|
||||
|
||||
# Check if user exists
|
||||
galtinn_users = await self.fetch_galtinn_users(discord_id=interaction.user.id)
|
||||
if galtinn_users is None:
|
||||
embed = embed_templates.error_fatal("Klarte ikke å hente data fra Galtinn. Prøv igjen senere!")
|
||||
await interaction.followup.send(embed=embed)
|
||||
return
|
||||
# API guarantees that there is only one or zero results so this is safe
|
||||
if galtinn_users.count == 0:
|
||||
embed = embed_templates.error_warning("Du er ikke registrert!")
|
||||
|
||||
Reference in new issue
Block a user