# HG changeset patch # User Teemu Piippo # Date 1412435908 -10800 # Node ID aa214b9504de39b0ca654ebe1bab6509ef12267d # Parent f6512aacb114de328540b49a026a65add84a09eb - refactor diff -r f6512aacb114 -r aa214b9504de cobalt.py --- a/cobalt.py Sat Oct 04 17:58:34 2014 +0300 +++ b/cobalt.py Sat Oct 04 18:18:28 2014 +0300 @@ -995,14 +995,13 @@ result = repo.hg_command (*args[1:]) self.privmsg (replyto, result) except hgapi.hgapi.HgException as e: - try: - # Blah, hgapi, why must your error messages be so hard to decipher? - rawmsg = e.message.replace('\n', '').replace('" +','').replace('\t','') - errmsg = re.compile (r'.*\btErr: (.+)Out:').match (errmsg).group (1) - self.privmsg (replyto, 'error: %s' % errmsg) - except: + result = decipher_hgapi_error (e) + + if result[0]: + self.privmsg (replyto, 'error: %s' % result[1]) + else: self.privmsg (replyto, 'error (unable to decipher error message)') - #tried + #fi #tried # else: # raiee logical_exception ("unknown command `.%s`" % command)