From e4bd0a56655950d22eccddd3764f6f12db41e9aa Mon Sep 17 00:00:00 2001 From: Barry Chen Date: Thu, 20 Sep 2018 15:44:48 -0500 Subject: [PATCH] Catch Watchdog upstream error. (#4871) (#4919) --- server/src/watchdog.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/src/watchdog.js b/server/src/watchdog.js index 54e993b5e7..a254dfa9f0 100644 --- a/server/src/watchdog.js +++ b/server/src/watchdog.js @@ -274,6 +274,15 @@ exports.handleResult = function(req) { throw err; } + // Check if there was an upstream error at PhotoDNA. + // We leave the result as null. + if (req.body.error) { + const err = new Error(`Watchdog submission encountered an error at PhotoDNA.`); + err.watchdogSubmissionId = String(record.id); + err.photodnaResponseStatus = req.body.response.Status; + throw err; + } + if (req.body.positive) { handlePositive(record); } else {