From 6507a5667dcf9275a02f868af3e885ddd2cd6675 Mon Sep 17 00:00:00 2001 From: Danny Spina Date: Mon, 19 Jun 2023 12:20:11 +0200 Subject: [PATCH] Testing some stuff --- dist/index.html | 9 ++++++++- index.ts | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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')