# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1527982463 -7200
# Node ID c7f4e3987ed0443d4551214e54fd3797d346232a
# Parent  420391fd56e5b0015b9b5f84f9baf2782387a957
mod_slack_webhooks: Fix error handling for JSON parsing

util.json follows the return nil,errmsg pattern, it does not throw hard
error as this code seemed to expect

diff -r 420391fd56e5 -r c7f4e3987ed0 mod_slack_webhooks/mod_slack_webhooks.lua
--- a/mod_slack_webhooks/mod_slack_webhooks.lua	Sun Jun 03 01:31:40 2018 +0200
+++ b/mod_slack_webhooks/mod_slack_webhooks.lua	Sun Jun 03 01:34:23 2018 +0200
@@ -97,7 +97,8 @@
 	if body_type == "application/x-www-form-urlencoded" then
 		post_body = formdecode(request.body);
 	elseif body_type == "application/json" then
-		if not pcall(function() post_body = json.decode(request.body) end) then
+		post_body = json.decode(request.body)
+		if not post_body then
 			return 420;
 		end
 	else