From 53db88e503590350c37c04ba30fd32c52ef1fb07 Mon Sep 17 00:00:00 2001
From: Alexander Schlemmer <alexander.schlemmer@ds.mpg.de>
Date: Sun, 19 May 2019 09:29:05 +0200
Subject: [PATCH] FIX: replaced an assertion with a corresponding error

---
 src/caosadvancedtools/utils.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/caosadvancedtools/utils.py b/src/caosadvancedtools/utils.py
index b86c32a2..1a8eaf98 100644
--- a/src/caosadvancedtools/utils.py
+++ b/src/caosadvancedtools/utils.py
@@ -26,7 +26,13 @@ import os
 
 
 def replace_path_prefix(path, old_prefix, new_prefix):
-    assert path.startswith(old_prefix)
+    """
+    Replaces the prefix old_prefix in path with new_prefix.
+
+    Raises a RuntimeError when the path does not start with old_prefix.
+    """
+    if not path.startswith(old_prefix):
+        raise RuntimeError("Path does not start with old_prefix")
     path = path[len(old_prefix):]
 
     return os.path.join(new_prefix, path)
-- 
GitLab