Skip to content

Commit

Permalink
fix: send correct error response on parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
error418 committed Nov 16, 2019
1 parent 5a17a43 commit f7dea99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f7dea99

Please sign in to comment.