From 976c998fd318a5315eba91e6eacfb4172ef2f3b6 Mon Sep 17 00:00:00 2001
From: Nabywaniec <localadmin_mnabywan@Campus.gsi.de>
Date: Thu, 25 Aug 2022 12:53:55 +0200
Subject: [PATCH] use variables for extenstions

---
 silecs_cli/silecs.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/silecs_cli/silecs.py b/silecs_cli/silecs.py
index 44f60ad..8b39324 100644
--- a/silecs_cli/silecs.py
+++ b/silecs_cli/silecs.py
@@ -113,7 +113,7 @@ def get_schema_path(silecs_design_deploy_path):
     if extension == SILECSDEPLOY:
         return DEPLOY_SHEMA_PATH
 
-    raise Exception("Error: Passed file for validation needs to have the extension '.silecsdesign' or '.silecsdeploy'")
+    raise Exception(f"Error: Passed file for validation needs to have the extension '.{SILECSDESIGN}' or '.{SILECSDEPLOY}'")
 
 
 def get_silecs_file_path_from_fesa(fesa_design_deploy_path):
@@ -127,7 +127,7 @@ def get_silecs_file_path_from_fesa(fesa_design_deploy_path):
     elif extension == DEPLOY:
         extension = SILECSDEPLOY
     else:
-        raise Exception("Error: Passed FESA file needs to have the extension '.design' or '.deploy'")
+        raise Exception(f"Error: Passed FESA file needs to have the extension '.{DESIGN}' or '.{DEPLOY}'")
 
     return os.path.join(project_dir, project_name + "." + extension)
 
@@ -192,7 +192,7 @@ def create_silecs_design(filepath, project_name):
 </SILECS-Design>"""
 
     if os.path.isfile(filepath):
-        raise Exception(f"Error: There is already a .silecsdesign file available: {os.path.abspath(filepath)}")
+        raise Exception(f"Error: There is already a .{SILECSDESIGN} file available: {os.path.abspath(filepath)}")
 
     with open(filepath, "w") as fp:
         fp.write(design_template)
@@ -222,7 +222,7 @@ def create_silecs_deploy(filepath, project_name):
 </SILECS-Deploy>"""
 
     if os.path.isfile(filepath):
-        raise Exception(f"Error: There is already a .silecsdeploy file available: {os.path.abspath(filepath)}")
+        raise Exception(f"Error: There is already a .{SILECSDEPLOY} file available: {os.path.abspath(filepath)}")
 
     with open(filepath, "w") as fp:
         fp.write(deploy_template)
-- 
GitLab