From fab99f563a24f1fd6d835c2b10b41c757f413103 Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas@kluyver.me.uk>
Date: Mon, 8 Jan 2024 16:43:32 +0000
Subject: [PATCH] Raise error if caldb_store folder not found

---
 src/cal_tools/calcat_interface2.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/cal_tools/calcat_interface2.py b/src/cal_tools/calcat_interface2.py
index 3fa0b6167..3ec10de53 100644
--- a/src/cal_tools/calcat_interface2.py
+++ b/src/cal_tools/calcat_interface2.py
@@ -212,12 +212,12 @@ def setup_client(
             ) from e
 
 
-_default_caldb_root = ...
+_default_caldb_root = None
 
 
 def _get_default_caldb_root():
     global _default_caldb_root
-    if _default_caldb_root is ...:
+    if _default_caldb_root is None:
         onc_path = Path("/common/cal/caldb_store")
         maxwell_path = Path("/gpfs/exfel/d/cal/caldb_store")
         if onc_path.is_dir():
@@ -225,7 +225,10 @@ def _get_default_caldb_root():
         elif maxwell_path.is_dir():
             _default_caldb_root = maxwell_path
         else:
-            _default_caldb_root = None
+            raise RuntimeError(
+                f"Neither {onc_path} nor {maxwell_path} was found. If the caldb_store "
+                "directory is at another location, pass its path as caldb_root."
+            )
 
     return _default_caldb_root
 
-- 
GitLab