Mercurial > prosody-modules
comparison mod_rest/mod_rest.lua @ 3879:3b31ff7b4c7c
mod_rest: Fix traceback
Might have been caused by receiving a stanza here. Otherwise how could
there be an util.error object without .context ?
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 04 Feb 2020 22:22:47 +0100 |
parents | 75b330d4fa6f |
children | 3d0e8e32453c |
comparison
equal
deleted
inserted
replaced
3878:9a3dfe0bf9fd | 3879:3b31ff7b4c7c |
---|---|
141 module:log("debug", "Sending[rest]: %s", result.stanza:top_tag()); | 141 module:log("debug", "Sending[rest]: %s", result.stanza:top_tag()); |
142 response.headers.content_type = send_type; | 142 response.headers.content_type = send_type; |
143 return encode(send_type, result.stanza); | 143 return encode(send_type, result.stanza); |
144 end, | 144 end, |
145 function (error) | 145 function (error) |
146 if error.context.stanza then | 146 if error.context and error.context.stanza then |
147 response.headers.content_type = send_type; | 147 response.headers.content_type = send_type; |
148 module:log("debug", "Sending[rest]: %s", error.context.stanza:top_tag()); | 148 module:log("debug", "Sending[rest]: %s", error.context.stanza:top_tag()); |
149 return encode(send_type, error.context.stanza); | 149 return encode(send_type, error.context.stanza); |
150 else | 150 else |
151 return error; | 151 return error; |