bitbake: uievent: add error to registerEventHandler return

Current code throws Exception("Could not register UI event handler")
if event handler can't be registered. The real reason of this is that
cooker is in busy state. Error message lacks information about this.

Added error message to the return value of registerEventHandler.
Included returned error message into the log message and exception
text.

(Bitbake rev: 07de1ca7d57dcd0cc37406feae2949da12a3fa7a)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh 2015-12-31 18:42:14 +02:00 committed by Richard Purdie
parent 01419d5565
commit 4e0de6eca2
2 changed files with 7 additions and 5 deletions

View File

@ -97,10 +97,10 @@ class BitBakeServerCommands():
# we don't allow connections if the cooker is running
if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]):
return None
return None, "Cooker is busy: %s" % bb.cooker.state.get_name(self.cooker.state)
self.event_handle = bb.event.register_UIHhandler(s, True)
return self.event_handle
return self.event_handle, 'OK'
def unregisterEventHandler(self, handlerNum):
"""

View File

@ -52,19 +52,21 @@ class BBUIEventQueue:
# giving up
while self.EventHandler == None and count_tries < 5:
self.EventHandle = self.BBServer.registerEventHandler(self.host, self.port)
self.EventHandle, error = self.BBServer.registerEventHandler(self.host, self.port)
if (self.EventHandle != None):
break
bb.warn("Could not register UI event handler %s:%d, retry" % (self.host, self.port))
errmsg = "Could not register UI event handler. Error: %s, " \
"host %s, port %d" % (error, self.host, self.port)
bb.warn("%s, retry" % errmsg)
count_tries += 1
import time
time.sleep(1)
if self.EventHandle == None:
raise Exception("Could not register UI event handler")
raise Exception(errmsg)
self.server = server