From f7dea995513674c24a13d66ad6c788c5ce8b061d Mon Sep 17 00:00:00 2001 From: error418 Date: Sat, 16 Nov 2019 12:09:15 +0100 Subject: [PATCH] fix: send correct error response on parsing errors --- src/webhook.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webhook.ts b/src/webhook.ts index d7b17e0..7ef8a48 100644 --- a/src/webhook.ts +++ b/src/webhook.ts @@ -61,7 +61,11 @@ class NebulaWebhook { reportData.payload.build = JSON.parse(reportData.payload.build as any); } catch (err) { log.warn("failed to parse gradle-metrics build payload. Skipping event."); - res.status(400).send("could not parse build payload. Check your request."); + res.status(400).send( + new Comms.Message.ErrorMessage( + new BadRequestError("could not parse build payload. Check your request.") + ) + ); return; }