Skip to content
This repository has been archived by the owner on Apr 19, 2019. It is now read-only.

Commit

Permalink
Don't prefix UserVisibleError value in replies
Browse files Browse the repository at this point in the history
Adding "Command ___ encountered an error" is more likely to confuse than
help when the plugin has deliberately handled the error.
  • Loading branch information
kxz committed Aug 1, 2015
1 parent 871e649 commit 8cc846a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions omnipresence/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,7 @@ def reply_from_error(self, failure, request):
message = 'Command \x02{}\x02 encountered an error'.format(
request.subaction)
if failure.check(UserVisibleError):
self.reply(
'{}: {}.'.format(message, failure.getErrorMessage()),
error_request)
self.reply(failure.getErrorMessage(), error_request)
return
log.err(failure, 'Error during command callback: %s %s' %
(request.subaction, request.content))
Expand Down
5 changes: 2 additions & 3 deletions omnipresence/test/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class BasicCommand(EventPlugin):
def on_command(self, msg):
args = msg.content.split()
exc_class = UserVisibleError if 'visible' in args else Exception
exc = exc_class('lorem ipsum')
exc = exc_class('Lorem ipsum.')
if 'defer' in args:
if 'failure' in args:
return fail(exc)
Expand Down Expand Up @@ -92,8 +92,7 @@ def assert_visible_error(self, deferred_result=None):
self.assertEqual(self.watcher.last_seen.action, 'privmsg')
self.assertEqual(self.watcher.last_seen.venue, '#foo')
self.assertEqual(self.watcher.last_seen.content, collapse("""
\x0314{}: Command \x02spam\x02 encountered an error: lorem
ipsum.""".format(self.other_user.nick)))
\x0314{}: Lorem ipsum.""".format(self.other_user.nick)))

def test_empty_buffer(self):
self.more()
Expand Down

0 comments on commit 8cc846a

Please sign in to comment.