[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/xeft 4f16722a47 38/55: Handle database errors
From: |
ELPA Syncer |
Subject: |
[elpa] externals/xeft 4f16722a47 38/55: Handle database errors |
Date: |
Fri, 13 Jan 2023 23:58:39 -0500 (EST) |
branch: externals/xeft
commit 4f16722a477d65592677a7446c1367511f0d5af2
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Handle database errors
* module/xapian-lite.cc: Update xapian-lite.
* xeft.el (xeft--after-save, xeft-full-reindex): Handle and print
explanation for database lock and corrupt error.
---
module/xapian-lite.cc | 16 ++++++++++++++++
xeft.el | 16 +++++++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/module/xapian-lite.cc b/module/xapian-lite.cc
index 2b48aefa7b..0b85ceaeb4 100644
--- a/module/xapian-lite.cc
+++ b/module/xapian-lite.cc
@@ -305,6 +305,18 @@ Fxapian_lite_reindex_file
"Cannot open the file");
return NULL;
}
+ catch (Xapian::DatabaseCorruptError &e)
+ {
+ emp_signal_message1 (env, "xapian-lite-database-corrupt-error",
+ e.get_description().c_str());
+ return NULL;
+ }
+ catch (Xapian::DatabaseLockError &e)
+ {
+ emp_signal_message1 (env, "xapian-lite-database-lock-error",
+ e.get_description().c_str());
+ return NULL;
+ }
catch (Xapian::Error &e)
{
emp_signal_message1 (env, "xapian-lite-lib-error",
@@ -414,6 +426,10 @@ emacs_module_init (struct emacs_runtime *ert)
EMACS_NOEXCEPT
"Generic xapian-lite error", "error");
emp_define_error (env, "xapian-lite-lib-error",
"Xapian library error", "xapian-lite-error");
+ emp_define_error (env, "xapian-lite-database-corrupt-error",
+ "Xapian library error", "xapian-lite-lib-error");
+ emp_define_error (env, "xapian-lite-database-lock-error",
+ "Xapian library error", "xapian-lite-lib-error");
emp_define_error (env, "xapian-lite-file-error",
"Cannot open file", "xapian-lite-error");
diff --git a/xeft.el b/xeft.el
index bf2632afca..5bc89d4bc1 100644
--- a/xeft.el
+++ b/xeft.el
@@ -183,7 +183,12 @@ Xeft doesn’t follow symlinks and ignores inaccessible
directories."
(defun xeft--after-save ()
"Reindex the file."
- (xapian-lite-reindex-file (buffer-file-name) xeft-database))
+ (condition-case _
+ (xapian-lite-reindex-file (buffer-file-name) xeft-database)
+ (xapian-lite-database-lock-error
+ (message "The Xeft database is locked (maybe there is another Xeft
instance running) so we will skip indexing this file for now"))
+ (xapian-lite-database-corrupt-error
+ (message "The Xeft database is corrupted! You should delete the database
and Xeft will recreate it. Make sure other programs are not messing with Xeft
database"))))
(defvar xeft-mode-map
(let ((map (make-sparse-keymap)))
@@ -328,8 +333,13 @@ Xeft doesn’t follow symlinks and ignores inaccessible
directories."
(defun xeft-full-reindex ()
"Do a full reindex of all files."
(interactive)
- (dolist (file (xeft--file-list))
- (xapian-lite-reindex-file file xeft-database)))
+ (condition-case _
+ (dolist (file (xeft--file-list))
+ (xapian-lite-reindex-file file xeft-database))
+ (xapian-lite-database-lock-error
+ (message "The Xeft database is locked (maybe there is another Xeft
instance running) so we will skip indexing for now"))
+ (xapian-lite-database-corrupt-error
+ (message "The Xeft database is corrupted! You should delete the database
and Xeft will recreate it. Make sure other programs are not messing with Xeft
database"))))
;;; Draw
- [elpa] externals/xeft dd14e69939 33/55: * README.md: Remove text about the dynamic mocule., (continued)
- [elpa] externals/xeft dd14e69939 33/55: * README.md: Remove text about the dynamic mocule., ELPA Syncer, 2023/01/13
- [elpa] externals/xeft f05eca90f6 46/55: * Makefile (CXXFLAGS): Remove -stdlib=libc++, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 270eeb1084 44/55: * xeft.el: Add version for package-vc-install., ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 0f56356d24 48/55: Switch to sr.ht, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft fa63432715 11/55: * Makefile (xeft-module.so): Fix linking flags, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 26389942e9 37/55: Minor change, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 6efff4f20d 12/55: Add conexcept qualifier, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 5c8adb7c51 28/55: * Makefile: Fix PREFIX., ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 78bf82b507 31/55: * xeft.el (xeft-refresh): Remove workaround for emacs-rime., ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 6d27d1a7ab 32/55: Replace xeft-module with xapian-lite, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 4f16722a47 38/55: Handle database errors,
ELPA Syncer <=
- [elpa] externals/xeft 321dd84b64 39/55: * Makefile: Add support for windows dylib extension, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 361ee04913 54/55: * xeft.el (xeft--download-module): Fix., ELPA Syncer, 2023/01/13
- [elpa] externals/xeft f193d6135e 42/55: Ignore dot directory and make file function customizable, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 4bdb052d81 55/55: * xeft.el: Bump to version 3.2., ELPA Syncer, 2023/01/13
- [elpa] externals/xeft babe67496a 52/55: Add xapian-lite source, ELPA Syncer, 2023/01/13
- [elpa] externals/xeft 2fd4dd6ef8 41/55: Update xapian-lite.cc, ELPA Syncer, 2023/01/13