diff --git a/index.js b/index.js index 528dbaf..f2c483e 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ import express from "express"; import logRequest from "./logger.js"; import { parse } from "node-html-parser"; +import { format } from "util"; const config = { FUCKING_ENDPOINT: @@ -27,14 +28,18 @@ app.get("/*/status/*", async (req, res) => { try { twitter_res = await fetch(target); } catch (err) { - returnres.status(502).send(err.message); + return res + .status(502) + .send("Error from Twitter API: " + format("%s", err)); } if (twitter_res.status == 200) { let body; try { body = await twitter_res.json(); } catch (err) { - return res.status(502).send(err.message); + return res + .status(502) + .send("Error from Twitter API: " + format("%s", err)); } let html = parse(body.html); let block = html.firstChild;