comparison mod_bookmarks2/mod_bookmarks2.lua @ 4911:a8e9949a6ad2

mod_bookmarks2: Ignore failure to delete nothing (thanks Ge0rG) Attempting to delete all bookmarks when the bookmarks node does not even exist logged a fairly harmless error that we now ignore.
author Kim Alvefur <zash@zash.se>
date Thu, 24 Mar 2022 14:56:30 +0100
parents 347894e08b4f
children
comparison
equal deleted inserted replaced
4910:5dffb85e62c4 4911:a8e9949a6ad2
153 153
154 if #bookmarks.tags == 0 then 154 if #bookmarks.tags == 0 then
155 if synchronise then 155 if synchronise then
156 -- If we set zero legacy bookmarks, purge the bookmarks 2 node. 156 -- If we set zero legacy bookmarks, purge the bookmarks 2 node.
157 module:log("debug", "No bookmark in the set, purging instead."); 157 module:log("debug", "No bookmark in the set, purging instead.");
158 return service:purge(namespace, jid, true); 158 local ok, err = service:purge(namespace, jid, true);
159 if not ok and err == "item-not-found" then
160 -- Nothing there already, all is well.
161 return true;
162 end
163 return ok, err;
159 else 164 else
160 return true; 165 return true;
161 end 166 end
162 end 167 end
163 168