Mercurial > libervia-web
comparison libervia/pages/_browser/bridge.py @ 1477:b28025a7cc28
browser (bride): use `BridgeInternalError` for unmanaged errors:
This is to avoid confusion with a backend internal error.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 21 Oct 2021 17:36:17 +0200 |
parents | 8998f01088ac |
children | 409d10211b20 |
comparison
equal
deleted
inserted
replaced
1476:c669b5bfb8a0 | 1477:b28025a7cc28 |
---|---|
21 if errback is not None: | 21 if errback is not None: |
22 errback(ret) | 22 errback(ret) |
23 else: | 23 else: |
24 print(f"bridge called failed: code: {xhr.response}, text: {xhr.statusText}") | 24 print(f"bridge called failed: code: {xhr.response}, text: {xhr.statusText}") |
25 if errback is not None: | 25 if errback is not None: |
26 errback({"fullname": "InternalError", "message": xhr.statusText}) | 26 errback({"fullname": "BridgeInternalError", "message": xhr.statusText}) |
27 | 27 |
28 def call(self, method_name, *args, callback, errback, **kwargs): | 28 def call(self, method_name, *args, callback, errback, **kwargs): |
29 xhr = window.XMLHttpRequest.new() | 29 xhr = window.XMLHttpRequest.new() |
30 xhr.bind('load', lambda ev: self.on_load(xhr, ev, callback, errback)) | 30 xhr.bind('load', lambda ev: self.on_load(xhr, ev, callback, errback)) |
31 xhr.bind('error', lambda ev: errback( | 31 xhr.bind('error', lambda ev: errback( |