A new response type is added "ERROR", which indicates a failure in the
command execution. In the future different types of error could be defined.
def handle(self):
r"handle() -> None :: Handle incoming events using the dispatcher."
(msg, addr) = self.file.recvfrom(65535)
def handle(self):
r"handle() -> None :: Handle incoming events using the dispatcher."
(msg, addr) = self.file.recvfrom(65535)
- result = self.dispatcher.dispatch(msg)
+ try:
+ result = self.dispatcher.dispatch(msg)
+ response = 'OK '
+ except Exception, e:
+ result = str(e)
+ response = 'ERROR '
- msg = 'OK %d\n%s' % (len(str(result)), result)
- self.file.sendto(msg, addr)
+ response += '%d\n%s' % (len(str(result)), result)
+ self.file.sendto(response, addr)
#try:
# d.dispatch(msg)
#except dis.BadRouteError, inst:
#try:
# d.dispatch(msg)
#except dis.BadRouteError, inst: