[commit] Fix ugly traceback on permissiondenied
authorIan Weller <ian@ianweller.org>
Wed, 2 Feb 2011 20:35:50 +0000 (14:35 -0600)
committerIan Weller <ian@ianweller.org>
Wed, 2 Feb 2011 20:35:50 +0000 (14:35 -0600)
src/mw/clicommands.py

index 0fa122adb0472c6bbe8fbda9eb4cc3aaf3e08f65..7acfba241ef53be5998d0e68cfa5cb82ff6609bb 100644 (file)
@@ -305,6 +305,11 @@ class CommitCommand(CommandBase):
                 if self.options.bot:
                     data['bot'] = 'bot'
                 response = self.api.call(data)
+                if 'error' in response:
+                    if 'code' in response['error']:
+                        if response['error']['code'] == 'permissiondenied':
+                            print 'Permission denied -- try running "mw login"'
+                            return
                 if response['edit']['result'] == 'Success':
                     if 'nochange' in response['edit']:
                         print 'warning: no changes detected in %s - ' \

Benjamin Mako Hill || Want to submit a patch?