diff --git a/plugins/FunCommands.py b/plugins/FunCommands.py index a0108001e..ce31dcf70 100644 --- a/plugins/FunCommands.py +++ b/plugins/FunCommands.py @@ -560,9 +560,11 @@ class FunCommands(callbacks.Privmsg): x = complex(eval(text, self._mathEnv, self._mathEnv)) irc.reply(msg, self._complexToString(x)) except OverflowError: - irc.reply(msg, 'Go get scanez, this is a *real* math problem!') + irc.error(msg, 'Go get scanez, this is a *real* math problem!') + except TypeError: + irc.error(msg, 'Something in there wasn\'t a valid number.') except Exception, e: - irc.reply(msg, debug.exnToString(e)) + irc.error(msg, debug.exnToString(e)) _rpnEnv = { 'dup': lambda s: s.extend([s.pop()]*2), diff --git a/test/test_FunCommands.py b/test/test_FunCommands.py index 4a1035c5b..ceee8814d 100644 --- a/test/test_FunCommands.py +++ b/test/test_FunCommands.py @@ -61,6 +61,8 @@ class FunCommandsTest(PluginTestCase, PluginDocumentation): self.assertResponse('calc e**(i*pi)+1', '0') self.assertResponse('calc (-5)**.5', '2.2360679775i') self.assertResponse('calc -((-5)**.5)', '-2.2360679775i') + self.assertNotRegexp('calc [9, 5] + [9, 10]', 'TypeError') + self.assertError('calc [9, 5] + [9, 10]') def testChr(self): for i in range(256):