branch: externals/triples
commit 7d7904e6decebc7c9861d38a9443127bf66a1643
Author: Andrew Hyatt <ahy...@gmail.com>
Commit: Andrew Hyatt <ahy...@gmail.com>

    Stop swallowing errors with Emacs 29's sqlite
---
 CHANGELOG.org |  2 ++
 triples.el    | 23 ++++++++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index c71b0515f2..14ab77edf5 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -1,5 +1,7 @@
 TITLE: Changelog for the triples module for GNU Emacs.
 
+* 0.2.2
+- Fix error behavior using Emacs builtin sqlite.  Now error is rethrown 
instead of swallowed.
 * 0.2.1
 - Add backup strategy =never=.
 * 0.2
diff --git a/triples.el b/triples.el
index d34b83eb42..f23965442b 100644
--- a/triples.el
+++ b/triples.el
@@ -6,7 +6,7 @@
 ;; Homepage: https://github.com/ahyatt/triples
 ;; Package-Requires: ((seq "2.0") (emacs "25"))
 ;; Keywords: triples, kg, data, sqlite
-;; Version: 0.2.1
+;; Version: 0.2.2
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
 ;; published by the Free Software Foundation; either version 2 of the
@@ -441,16 +441,17 @@ The transaction will abort if an error is thrown."
 
 (defun triples--with-transaction (db body-fun)
   (pcase triples-sqlite-interface
-    ('builtin  (condition-case nil
-                   (progn
-                     (sqlite-transaction db)
-                     (funcall body-fun)
-                     (sqlite-commit db))
-                 (error (sqlite-rollback db))))
-    ('emacsql (funcall (triples--eval-when-fboundp emacsql-with-transaction
-                         (lambda (db body-fun)
-                           (emacsql-with-transaction db (funcall body-fun))))
-                       db body-fun))))
+      ('builtin  (condition-case err
+                     (progn
+                       (sqlite-transaction db)
+                       (funcall body-fun)
+                       (sqlite-commit db))
+                   (error (sqlite-rollback db)
+                          (signal (car err) (cdr err)))))
+      ('emacsql (funcall (triples--eval-when-fboundp emacsql-with-transaction
+                           (lambda (db body-fun)
+                             (emacsql-with-transaction db (funcall body-fun))))
+                         db body-fun))))
 
 (defun triples-set-types (db subject &rest combined-props)
   "Set all data for types in COMBINED-PROPS in DB for SUBJECT.

Reply via email to