diff --git a/dist/index.html b/dist/index.html index da510b4..ab0dc77 100644 --- a/dist/index.html +++ b/dist/index.html @@ -48,10 +48,17 @@ timeout errors from occurring.

diff --git a/index.ts b/index.ts index ee08a89..5c32989 100644 --- a/index.ts +++ b/index.ts @@ -24,6 +24,13 @@ app.get("/", (req, res) => { got(`${searchEngine}?q=${query}`) .then((response) => { + + if (response.statusCode !== 200) { + console.log("Error code:", response.statusCode) + res.send(`Error code ${response.statusCode}`) + return; + } + const dom = new JSDOM(response.body); const links = dom.window.document.querySelectorAll('link') const results = dom.window.document.querySelectorAll('.result')