changeset 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 5dffb85e62c4
children b45c23ce24ba
files mod_bookmarks2/mod_bookmarks2.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_bookmarks2/mod_bookmarks2.lua	Sat Mar 19 17:52:33 2022 +0000
+++ b/mod_bookmarks2/mod_bookmarks2.lua	Thu Mar 24 14:56:30 2022 +0100
@@ -155,7 +155,12 @@
 		if synchronise then
 			-- If we set zero legacy bookmarks, purge the bookmarks 2 node.
 			module:log("debug", "No bookmark in the set, purging instead.");
-			return service:purge(namespace, jid, true);
+			local ok, err = service:purge(namespace, jid, true);
+			if not ok and err == "item-not-found" then
+				-- Nothing there already, all is well.
+				return true;
+			end
+			return ok, err;
 		else
 			return true;
 		end