- handle hg errors better

Sat, 21 Jun 2014 17:40:49 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 21 Jun 2014 17:40:49 +0300
changeset 21
8c389f46a056
parent 20
2603faf5f91b
child 22
3e2ce6056fb7

- handle hg errors better

cobalt.py file | annotate | diff | comparison | revisions
--- a/cobalt.py	Sat Jun 21 17:11:58 2014 +0300
+++ b/cobalt.py	Sat Jun 21 17:40:49 2014 +0300
@@ -340,8 +340,10 @@
 				args = stuff[1:]
 				try:
 					self.handle_command (sender, user, host, replyto, command, args)
-				except logical_exception as msg:
-					self.privmsg (replyto, "error: %s" % msg)
+				except logical_exception as e:
+					for line in e.value.split ('\n'):
+						if len(line) > 0:
+							self.privmsg (replyto, "error: %s" % line)
 			elif http_match:
 				self.get_ticket_data (replyto, http_match.group (2), False)
 		else:
@@ -402,6 +404,8 @@
 			if len(args) != 1:
 				raise logical_exception ("usage: .%s <ticket>" % command)
 			self.announce_ticket (bt_getissue (args[0]))
+		elif command == 'multierror':
+			raise logical_exception ('a\nb\nc\n')
 		elif command == 'idgames':
 			try:
 				if len(args) < 1:
@@ -455,7 +459,7 @@
 				else:
 					self.privmsg (replyto, 'Up to date at %s.' % r2)
 			except hgapi.HgException as e:
-				raise logical_exception ('Search failed: %s' % `e`)
+				raise logical_exception ('Update failed: %s' % str (e))
 		elif command == 'addchan':
 			check_admin (sender, ident, host, command)
 			if len(args) != 1:

mercurial