Skip to content

Commit

Permalink
Add PermissionDenied exception
Browse files Browse the repository at this point in the history
  • Loading branch information
godwhoa committed Feb 16, 2018
1 parent d64568f commit cc1076a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions piqueserver/commands.py
Expand Up @@ -36,6 +36,10 @@ class CommandError(Exception):
pass


class PermissionDenied(Exception):
pass


def command(name=None, *aliases, **kwargs):
"""
Register a new command.
Expand Down Expand Up @@ -379,6 +383,8 @@ def handle_command(connection, command, parameters):
msg = 'Command failed'
except CommandError as e:
msg = str(e)
except PermissionDenied:
msg = "Permission denied"
except ValueError:
msg = 'Invalid parameters'

Expand Down

0 comments on commit cc1076a

Please sign in to comment.