Capture DNS errors as well

master
Sven Slootweg 5 years ago
parent 9f861318b8
commit aca46ea5bf

@ -58,6 +58,10 @@ This error type correctly inherits from `Error`, and can be used with `instanceo
## Changelog
### 1.0.2 (August 31, 2019)
- DNS errors now also result in a `LookupFailed` error, like they should.
### 1.0.1 (August 30, 2019)
- Added input validation with an informative error to the `discover` method.

@ -60,6 +60,8 @@ function validateHomeserverUrl(homeserverUrl) {
throwLookupError("homeserver returned invalid JSON, maybe it is not a Matrix server?");
}).catch(ValidationError, (_error) => {
throwLookupError("homeserver returned an invalid version response, maybe it is not a Matrix server?");
}).catch({ code: "ENOTFOUND" }, () => {
throwLookupError("hostname of homeserver does not exist");
});
}
@ -150,6 +152,8 @@ function attemptWellKnown(host) {
}
}).catch(getJson.ParsingFailed, (_error) => {
throwLookupError("host returned invalid JSON");
}).catch({ code: "ENOTFOUND" }, () => {
throwLookupError("hostname does not exist");
});
}

Loading…
Cancel
Save