diff options
author | Frantisek Kobzik <fkobzik@redhat.com> | 2014-10-30 10:35:15 +0100 |
---|---|---|
committer | Jeremy White <jwhite@codeweavers.com> | 2014-10-31 15:18:19 -0500 |
commit | b926f062f35e298f65828d9835f5b35895ec3729 (patch) | |
tree | f5a6ab6189ae2fd5093b3cf457d060aee5f7bf74 | |
parent | dea87ff943e18aa37b9dad5ef0a5fb4b5cc6ac1b (diff) |
SPICE-HTML5: Improve error message
Current error message in SPICE-HTML5 error is poor (error-logging function
prints error.toString() which doesn't contain anything detailed).
This patch enhances this message in the following way:
- error event contains target attribute ([1]),
- the code in this patch checks for presence of 'url' attribute (which is
contained in WebSocket object[2]). If the target contains url then
meaningful message is logged.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Event
[2]: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
-rw-r--r-- | spiceconn.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/spiceconn.js b/spiceconn.js index e33227e..ceebd5d 100644 --- a/spiceconn.js +++ b/spiceconn.js @@ -78,7 +78,9 @@ function SpiceConn(o) this.parent.state = "start"; }); this.ws.addEventListener('error', function(e) { - this.parent.log_err(">> WebSockets.onerror" + e.toString()); + if ('url' in e.target) { + this.parent.log_err("WebSocket error: Can't connect to websocket on URL: " + e.target.url); + } this.parent.report_error(e); }); this.ws.addEventListener('close', function(e) { |