Mercurial > prosody-modules
diff mod_rest/mod_rest.lua @ 4988:732229fe68ab
mod_rest: Fill in 'type' field in error registry
The 'type' defaults to "modify" in util.error, which doesn't quite fit
many of these error conditions.
LuaFormatter changed ',' to ';'
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 15 Aug 2022 15:26:14 +0200 |
parents | 537054999093 |
children | cb19cb1c03d6 |
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua Fri Aug 12 17:15:11 2022 +0200 +++ b/mod_rest/mod_rest.lua Mon Aug 15 15:26:14 2022 +0200 @@ -262,17 +262,17 @@ end local post_errors = errors.init("mod_rest", { - noauthz = { code = 401, type = "auth", condition = "not-authorized", text = "No credentials provided" }, - unauthz = { code = 403, type = "auth", condition = "not-authorized", text = "Credentials not accepted" }, - parse = { code = 400, condition = "not-well-formed", text = "Failed to parse payload", }, - xmlns = { code = 422, condition = "invalid-namespace", text = "'xmlns' attribute must be empty", }, - name = { code = 422, condition = "unsupported-stanza-type", text = "Invalid stanza, must be 'message', 'presence' or 'iq'.", }, - to = { code = 422, condition = "improper-addressing", text = "Invalid destination JID", }, - from = { code = 422, condition = "invalid-from", text = "Invalid source JID", }, - from_auth = { code = 403, condition = "not-authorized", text = "Not authorized to send stanza with requested 'from'", }, - iq_type = { code = 422, condition = "invalid-xml", text = "'iq' stanza must be of type 'get' or 'set'", }, - iq_tags = { code = 422, condition = "bad-format", text = "'iq' stanza must have exactly one child tag", }, - mediatype = { code = 415, condition = "bad-format", text = "Unsupported media type" }, + noauthz = { code = 401; type = "auth"; condition = "not-authorized"; text = "No credentials provided" }; + unauthz = { code = 403; type = "auth"; condition = "not-authorized"; text = "Credentials not accepted" }; + parse = { code = 400; type = "modify"; condition = "not-well-formed"; text = "Failed to parse payload" }; + xmlns = { code = 422; type = "modify"; condition = "invalid-namespace"; text = "'xmlns' attribute must be empty" }; + name = { code = 422; type = "modify"; condition = "unsupported-stanza-type"; text = "Invalid stanza, must be 'message', 'presence' or 'iq'." }; + to = { code = 422; type = "modify"; condition = "improper-addressing"; text = "Invalid destination JID" }; + from = { code = 422; type = "modify"; condition = "invalid-from"; text = "Invalid source JID" }; + from_auth = { code = 403; type = "auth"; condition = "not-authorized"; text = "Not authorized to send stanza with requested 'from'" }; + iq_type = { code = 422; type = "modify"; condition = "invalid-xml"; text = "'iq' stanza must be of type 'get' or 'set'" }; + iq_tags = { code = 422; type = "modify"; condition = "bad-format"; text = "'iq' stanza must have exactly one child tag" }; + mediatype = { code = 415; type = "cancel"; condition = "bad-format"; text = "Unsupported media type" }; }); -- GET → iq-get