Mercurial > libervia-backend
changeset 2441:e86dc8cb4345
jp (debug/monitor): if data can't be parsed (happen at beginning/end of stream because it's not complete XML), it is printed directly.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 19 Nov 2017 16:38:35 +0100 |
parents | 51d346e283fd |
children | b8ffb7f8056b |
files | frontends/src/jp/cmd_debug.py |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/jp/cmd_debug.py Sat Nov 18 18:49:57 2017 +0100 +++ b/frontends/src/jp/cmd_debug.py Sun Nov 19 16:38:35 2017 +0100 @@ -138,7 +138,16 @@ if whiteping: self.disp('[WHITESPACE PING]') else: - self.output(xml_data) + try: + self.output(xml_data) + except Exception: + # initial stream is not valid XML, + # in this case we print directly to data + # FIXME: we should test directly lxml.etree.XMLSyntaxError + # but importing lxml directly here is not clean + # should be wrapped in a custom Exception + self.disp(xml_data) + self.disp(u'') def start(self): self.host.bridge.register_signal('xmlLog', self.printXML, 'plugin')