From b52cdd5bbeb49a6da5165ca0ee7a24d2eeee67d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97SO?= <142557582+Linxiushen@users.noreply.github.com> Date: Wed, 5 Aug 2026 22:36:19 +0800 Subject: [PATCH] fix(triplet-store): preserve missing backend dependency errors --- semantica/triplet_store/triplet_store.py | 4 +++- tests/triplet_store/test_oxigraph_store.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/semantica/triplet_store/triplet_store.py b/semantica/triplet_store/triplet_store.py index 7c740722..18d1a965 100644 --- a/semantica/triplet_store/triplet_store.py +++ b/semantica/triplet_store/triplet_store.py @@ -156,9 +156,11 @@ class TripletStore: self.logger.info(f"Initialized {self.backend_type} backend") + except ImportError: + raise except Exception as e: self.logger.error(f"Failed to initialize {self.backend_type} backend: {e}") - raise ProcessingError(f"Failed to initialize backend: {e}") + raise ProcessingError(f"Failed to initialize backend: {e}") from e def store( self, diff --git a/tests/triplet_store/test_oxigraph_store.py b/tests/triplet_store/test_oxigraph_store.py index 40e0b9b1..cbd3c979 100644 --- a/tests/triplet_store/test_oxigraph_store.py +++ b/tests/triplet_store/test_oxigraph_store.py @@ -158,4 +158,4 @@ def test_missing_optional_dependency_has_install_hint(): side_effect=import_without_oxigraph, ): with pytest.raises(ImportError, match="tripletstore-oxigraph"): - OxigraphStore() + _store()