diff --git a/README.md b/README.md index 155799c..fae1597 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/index.js b/index.js index a23a75c..6596443 100644 --- a/index.js +++ b/index.js @@ -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"); }); }