From 0a1f800659c0dabff8006d7b83157ccef3eaa502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Mon, 4 Jun 2018 11:38:04 +0200 Subject: [PATCH] Added a catch in promise for Jimp read --- server/handlers/list.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/handlers/list.js b/server/handlers/list.js index 81d474fc..b63df96c 100644 --- a/server/handlers/list.js +++ b/server/handlers/list.js @@ -701,6 +701,14 @@ function sendColor(coll, socket, url, ajax, res) { io.to(coll).emit("color", {color: c, only: false}); } } + }).catch(function(err) { + console.log("Crashed on fetching image, url is " + url); + console.log("Is ajax: " + ajax); + if(ajax) { + res.header({"Content-Type": "application/json"}); + res.status(404); + return; + } }); }