I'm writing a Stream Deck plugin in Javascript and I want to log errors to a file. I can't figure out how to capture details of network errors. These errors appear in the debug console, but how can I get them in my own log? The xhr.onerror()
method returns not much useful info, just status code 0.
I tried adding a window error event listener, but that never triggers. For example this code here:
var xhr = new XMLHttpRequest()
xhr.onerror = function() {console.log('xhr error', arguments)}
window.onerror = function() {console.log('window error', arguments)}
xhr.open('GET', 'http://badurl12345')
xhr.send()
Running this code in the debug console, I see GET http://badurl12345/ net::ERR_NAME_NOT_RESOLVED
. But I can't get this info from the error handler.