From 6a57c01e63d119a2bf90ba50cd69968807c076b0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 3 Nov 2022 04:06:45 +0300 Subject: Handle oembed timeouts --- vnext/server/middleware/oembed.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'vnext') diff --git a/vnext/server/middleware/oembed.js b/vnext/server/middleware/oembed.js index 43bed194..ea53ca9c 100644 --- a/vnext/server/middleware/oembed.js +++ b/vnext/server/middleware/oembed.js @@ -11,9 +11,8 @@ const oembed = async (req, res) => { res.send(result); res.end(); }).catch(err => { - console.log(`Err: ${err.response.status}`); - res.status(err.response.status); - res.send({}); + console.log(`Err: ${err.response ? err.response.status : err.code}`); + res.sendStatus(err.response ? err.response.status : 500); res.end(); }); }; -- cgit v1.2.3