Skip to content

Should handle errors #22

@YaaL

Description

@YaaL
var XMLHttpRequest = require('w3c-xmlhttprequest').XMLHttpRequest;
var client = new XMLHttpRequest();
client.open('GET', 'http://some.invalid-url.com');
client.addEventListener('load', function(event) {
    console.log('Loaded.');
});
client.addEventListener('error', function(err) {
    console.log('Error:', err);
});
client.send();

Results in:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)

I should receive an XMLHttpRequestProgressEvent and be able to handle it, not have my app crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions