Skip to content

Commit

Permalink
Adding generic exception handling when running a command
Browse files Browse the repository at this point in the history
  • Loading branch information
craigmaloney committed May 29, 2018
1 parent b217f2c commit 0977330
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/tootstream/toot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2140,9 +2140,12 @@ def main(instance, config, profile):
rest = command[1]
except IndexError:
pass
command = command[0]
cmd_func = commands.get(command, say_error)
cmd_func(mastodon, rest)
try:
command = command[0]
cmd_func = commands.get(command, say_error)
cmd_func(mastodon, rest)
except Exception as e:
cprint(e, fg('red'))


if __name__ == '__main__':
Expand Down

0 comments on commit 0977330

Please sign in to comment.