comparison mod_profile/mod_profile.lua @ 1745:851cb0b3d584

mod_profile: Return error on storage error, don't attempt to migrate from old storage
author Kim Alvefur <zash@zash.se>
date Mon, 18 May 2015 02:58:17 +0200
parents fbef84033fae
children b64c0150d663
comparison
equal deleted inserted replaced
1744:fbef84033fae 1745:851cb0b3d584
85 local function handle_get(event) 85 local function handle_get(event)
86 local origin, stanza = event.origin, event.stanza; 86 local origin, stanza = event.origin, event.stanza;
87 local username = origin.username; 87 local username = origin.username;
88 local to = stanza.attr.to; 88 local to = stanza.attr.to;
89 if to then username = jid_split(to); end 89 if to then username = jid_split(to); end
90 local data = storage:get(username); 90 local data, err = storage:get(username);
91 if not data then 91 if not data then
92 if err then
93 origin.send(st.error_reply(stanza, "cancel", "internal-server-error", err));
94 return true;
95 end
92 data = legacy_storage:get(username); 96 data = legacy_storage:get(username);
93 data = data and st.deserialize(data); 97 data = data and st.deserialize(data);
94 if data then 98 if data then
95 origin.send(st.reply(stanza):add_child(data)); 99 origin.send(st.reply(stanza):add_child(data));
96 return true; 100 return true;