X-Git-Url: https://git.llucax.com/software/pymin.git/blobdiff_plain/7dfccdecbf326e5f3355672cfa6e0b67697652af..6f9f028c43f77c76a0ac6d4f4f7223e5c6e2ba64:/pymindaemon.py diff --git a/pymindaemon.py b/pymindaemon.py index c3fdda6..f3f45fb 100644 --- a/pymindaemon.py +++ b/pymindaemon.py @@ -65,8 +65,13 @@ class PyminDaemon(eventloop.EventLoop): if result is not None: result = serializer.serialize(result) response = u'OK ' + except dispatcher.Error, e: + result = unicode(e) + u'\n' + response = u'ERROR ' except Exception, e: - result = unicode(e) + import traceback + result = u'Internal server error\n' + traceback.print_exc() # TODO logging! response = u'ERROR ' if result is None: response += u'0' @@ -83,13 +88,11 @@ class PyminDaemon(eventloop.EventLoop): if __name__ == '__main__': - from dispatcher import handler - - @handler + @handler(u"Print all the arguments, return nothing.") def test_handler(*args): print 'test:', args - @handler + @handler(u"Echo the message passed as argument.") def echo_handler(message): print 'echo:', message return message