- refactor

Sat, 04 Oct 2014 18:18:28 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 04 Oct 2014 18:18:28 +0300
changeset 41
aa214b9504de
parent 40
f6512aacb114
child 42
adbf42ede463

- refactor

cobalt.py file | annotate | diff | comparison | revisions
--- 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)

mercurial