Fixed issue in sending error messages.
parent
93827f5f90
commit
a13e1c9af2
|
@ -44,9 +44,6 @@ class Commands:
|
|||
base = self.interface.add_base(session, player, base_name, x_pos, z_pos)
|
||||
|
||||
base_name = base.name
|
||||
except EntryNameNotUniqueError:
|
||||
session.rollback()
|
||||
raise EntryNameNotUniqueError
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
|
@ -81,9 +78,6 @@ class Commands:
|
|||
|
||||
tunnel = self.interface.add_tunnel(session, player, tunnel_color, tunnel_number, location_name)
|
||||
tunnel_info = tunnel.__str__()
|
||||
except EntryNameNotUniqueError:
|
||||
session.rollback()
|
||||
raise EntryNameNotUniqueError
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
|
|
|
@ -44,11 +44,12 @@ async def on_command_error(error, ctx):
|
|||
elif isinstance(error.original, EntryNameNotUniqueError):
|
||||
error_str = 'An entry in the database already has that name ding dong.'
|
||||
elif isinstance(error.original, DatabaseValueError):
|
||||
error_str = 'Use a shorter name or a smaller value, dong ding.'
|
||||
error_str = 'Use a shorter name or a smaller value, dong ding.'
|
||||
else:
|
||||
error_str = bad_error_message.format(ctx.invoked_with, error)
|
||||
|
||||
bot.send_message(ctx.message.channel, '**Error Running Command:** {}'.format(error_str))
|
||||
await bot.send_message(ctx.message.channel, '{} **Error Running Command:** {}'.format(ctx.message.author.mention,
|
||||
error_str))
|
||||
|
||||
|
||||
@bot.command()
|
||||
|
|
Loading…
Reference in New Issue