From 3f6c892c774545f5b67afc1c90b080ef2c32fa1a Mon Sep 17 00:00:00 2001
From: George Marchment <georgemarchment@yahoo.fr>
Date: Wed, 2 Apr 2025 13:45:31 +0200
Subject: [PATCH] Update the handling of errors

---
 src/bioflowinsighterror.py |  6 +++---
 src/call.py                |  6 +++---
 src/channel.py             |  2 +-
 src/code_.py               |  2 +-
 src/emitted.py             |  2 +-
 src/executor.py            |  2 +-
 src/include.py             |  2 +-
 src/main.py                |  6 +++---
 src/nextflow_file.py       |  8 ++++----
 src/operation.py           | 12 ++++++------
 src/outils.py              | 15 ++++++++-------
 src/outils_graph.py        | 10 +++++-----
 src/process.py             | 12 +++++++-----
 src/root.py                |  8 ++++----
 src/subworkflow.py         |  8 ++++----
 src/workflow.py            |  4 ++--
 16 files changed, 54 insertions(+), 51 deletions(-)

diff --git a/src/bioflowinsighterror.py b/src/bioflowinsighterror.py
index 3166381..a146a85 100644
--- a/src/bioflowinsighterror.py
+++ b/src/bioflowinsighterror.py
@@ -9,13 +9,13 @@ class BioFlowInsightError(Exception):
         origin: A "Nextflow Building Bloc" derived type object, from this the file address can be given to the user
         
     """
-    def __init__(self, error, num=None, origin = None):
+    def __init__(self, error, type=None, origin = None):
         self.origin = origin
-        if(num!=None):
+        if(type!=None):
             #if(origin!=None):
             #    super().__init__(f"[{num}] Error in the file '{self.origin.get_file_address()}': "+error)
             #else:
-            super().__init__(f"[{num}] {error}")
+            super().__init__(f"[{type}] {error}")
         else:
             super().__init__(f"{error}")
 
diff --git a/src/call.py b/src/call.py
index 8873b57..bacbc20 100644
--- a/src/call.py
+++ b/src/call.py
@@ -348,7 +348,7 @@ class Call(Executor):
                 #    
                 #else:
                 #    raise BioFlowInsightError(f"Not the same number of parameters given as input for the process '{process.get_alias()}'{self.get_string_line(self.get_code(get_OG=True))}.", num=2, origin=self)
-                raise BioFlowInsightError(f"Not the same number of parameters given as input for the process '{process.get_alias()}'{self.get_string_line(self.get_code(get_OG=True))}.", num=2, origin=self)
+                raise BioFlowInsightError(f"Not the same number of parameters given as input for the process '{process.get_alias()}'{self.get_string_line(self.get_code(get_OG=True))}.", type=2, origin=self)
         
         elif(self.get_first_element_called().get_type()=="Subworkflow"):
             sub = self.get_first_element_called()
@@ -405,7 +405,7 @@ class Call(Executor):
             ##If they are not -> we check that the right number isn't implied
             else:
                 #TODO check this
-                raise BioFlowInsightError(f"Not the same number of parameters given as input for the subworklfow '{sub.get_alias()}' in the call{self.get_string_line(self.get_code())}.", num = 2, origin=self)
+                raise BioFlowInsightError(f"Not the same number of parameters given as input for the subworklfow '{sub.get_alias()}' in the call{self.get_string_line(self.get_code())}.", type = 2, origin=self)
             #    num_inputs = 0
             #    for p in self.parameters:
             #        if(p.get_type()=="Call"):
@@ -509,7 +509,7 @@ class Call(Executor):
                 raise Exception("No first call found!!")
             self.called.append(self.first_element_called)
         else:
-            raise BioFlowInsightError(f"Failed to extract the call{self.get_string_line(self.get_code())}. Try rewriting it in a simplified version.", num = 15, origin=self)
+            raise BioFlowInsightError(f"Failed to extract the call{self.get_string_line(self.get_code())}. Try rewriting it in a simplified version.", type = 15, origin=self)
 
     
     
diff --git a/src/channel.py b/src/channel.py
index 7ca4387..28227bb 100644
--- a/src/channel.py
+++ b/src/channel.py
@@ -22,7 +22,7 @@ class Channel(Nextflow_Building_Blocks):
         for m in self.get_modules_defined():
             to_call.append(m.get_alias())
         if(self.name in to_call):
-            raise BioFlowInsightError(f"'{self.name}' is trying to be created as a channel{self.get_string_line(self.origin.get_code())}. It already exists as a process, a function or a subworkflow in the nextflow file.", num = 4, origin=self)
+            raise BioFlowInsightError(f"'{self.name}' is trying to be created as a channel{self.get_string_line(self.origin.get_code())}. It already exists as a process, a function or a subworkflow in the nextflow file.", type = 4, origin=self)
         
 
 
diff --git a/src/code_.py b/src/code_.py
index 295f564..6a44399 100644
--- a/src/code_.py
+++ b/src/code_.py
@@ -31,7 +31,7 @@ class Code:
         for illegal in constant.ILLEGAL_IMPORTS:
             for match in re.finditer(constant.START_IMPORT+illegal, self.get_code()):
                 bit_of_code = match.group(0)
-                raise BioFlowInsightError(f"The presence of '{bit_of_code}' is detected{self.get_string_line(bit_of_code)}.", num = 1,origin=self)
+                raise BioFlowInsightError(f"The presence of '{bit_of_code}' is detected{self.get_string_line(bit_of_code)}.", type = 1,origin=self)
             
    
     #This methods turns a single line condition into a muli line conditions 
diff --git a/src/emitted.py b/src/emitted.py
index ba60636..e452b38 100644
--- a/src/emitted.py
+++ b/src/emitted.py
@@ -81,7 +81,7 @@ class Emitted(Channel):
             else:
                 if(thing_which_emits.get_type()=='Subworkflow'):
                     if(len(thing_which_emits.emit)!=1):
-                        raise BioFlowInsightError(f"One channel was expected in the emit '{self.get_code()}'. Even though multiple emits are defined for the workflow '{self.emitted_by.get_first_element_called().get_name()}'", num=6, origin=self)
+                        raise BioFlowInsightError(f"One channel was expected in the emit '{self.get_code()}'. Even though multiple emits are defined for the workflow '{self.emitted_by.get_first_element_called().get_name()}'", type=6, origin=self)
                     self.emits = thing_which_emits.emit[0]
                 else:
                     raise Exception("This shoudn't happen!")
diff --git a/src/executor.py b/src/executor.py
index dca03da..0080ea3 100644
--- a/src/executor.py
+++ b/src/executor.py
@@ -191,7 +191,7 @@ class Executor(Nextflow_Building_Blocks):
                             if not added:
                                 if(re.fullmatch(constant.OPERATOR_IN_PIPE, thing)):
                                     raise Exception('problem')
-                                raise BioFlowInsightError(f"Don't know how to handle '{thing}' in a pipe operator{self.get_string_line(thing)}. Try using the recommended operator composition.", num=3,origin = self)
+                                raise BioFlowInsightError(f"Don't know how to handle '{thing}' in a pipe operator{self.get_string_line(thing)}. Try using the recommended operator composition.", type=3,origin = self)
                         
                     else:
                         pipe = str(self).join([left_side, right_side])
diff --git a/src/include.py b/src/include.py
index 39627e1..a86fdd9 100644
--- a/src/include.py
+++ b/src/include.py
@@ -87,7 +87,7 @@ class Include(Nextflow_Building_Blocks):
                 self.nextflow_file = Nextflow_File(address, workflow = self.nextflow_file_origin.get_workflow(), first_file=False)
             else:
                 address = os.path.normpath(address)
-                raise BioFlowInsightError(f"Something went wrong in an include{self.get_string_line(self.get_code())}. No such file: '{address}'.", num = 10,origin=self)
+                raise BioFlowInsightError(f"Something went wrong in an include{self.get_string_line(self.get_code())}. No such file: '{address}'.", type = 10,origin=self)
 
         
         #If not duplicate -> we need to see if there is another include which has already defined the file
diff --git a/src/main.py b/src/main.py
index ac73acc..426ba4d 100644
--- a/src/main.py
+++ b/src/main.py
@@ -22,7 +22,7 @@ class Main(Nextflow_Building_Blocks):
             code = e.get_code(get_OG = True)
             #We don't have to check the calls -> since there are renamed with their ids when we rewrite the code -> so it solve the issue
             if(code in seen and e.get_type()=="Operation"):
-                raise BioFlowInsightError(f'Operation "{code}" appears twice in the workflow in the exact same way. BioFlow-Insight cannot rewrite the workflow then, try slighly changing how one of the executors is defined')
+                raise BioFlowInsightError(f'Operation "{code}" appears twice in the workflow in the exact same way. BioFlow-Insight cannot rewrite the workflow then, try slighly changing how one of the executors is defined', type = "Rewrite Error")
             seen[code] = ''
             pos[e] = e.get_position_in_main(e)
         #TODO add sort here
@@ -166,9 +166,9 @@ class Main(Nextflow_Building_Blocks):
         pattern = constant.FULL_INCLUDE
         for match in re.finditer(pattern, code):
             if(self.get_type()=="Main"):
-                raise BioFlowInsightError(f"An include ('{match.group(0)}') was found in the main in the file '{self.get_file_address()}'. FlowInsight does not support this -> see specification list.", num = 12,origin=self)
+                raise BioFlowInsightError(f"An include ('{match.group(0)}') was found in the main in the file '{self.get_file_address()}'. FlowInsight does not support this -> see specification list.", type = 12,origin=self)
             elif(self.get_type()=="Subworkflow"):
-                raise BioFlowInsightError(f"An include ('{match.group(0)}') was found in the subworkflow '{self.get_name()}' in the file '{self.get_file_address()}'. FlowInsight does not support this -> see specification list.", num = 12, origin=self)
+                raise BioFlowInsightError(f"An include ('{match.group(0)}') was found in the subworkflow '{self.get_name()}' in the file '{self.get_file_address()}'. FlowInsight does not support this -> see specification list.", type = 12, origin=self)
             else:
                 raise Exception("This shouldn't happen!")
             
diff --git a/src/nextflow_file.py b/src/nextflow_file.py
index c4dfcd8..cbf1edf 100644
--- a/src/nextflow_file.py
+++ b/src/nextflow_file.py
@@ -67,14 +67,14 @@ class Nextflow_File(Nextflow_Building_Blocks):
         if(code.count("{")!=code.count("}")):
             curly_count = get_curly_count(code)
             if(curly_count!=0):
-                raise BioFlowInsightError(f"Not the same number of opening and closing curlies '{'{}'}' in the file.", num = 16,origin=self)
+                raise BioFlowInsightError(f"Not the same number of opening and closing curlies '{'{}'}' in the file.", type = 16,origin=self)
         if(code.count("(")!=code.count(")")):
             parenthese_count = get_parenthese_count(code)
             if(parenthese_count!=0):
-                raise BioFlowInsightError(f"Not the same number of opening and closing parentheses '()' in the file.", num = 16, origin=self)
+                raise BioFlowInsightError(f"Not the same number of opening and closing parentheses '()' in the file.", type = 16, origin=self)
             
         if(code.count('"""')%2!=0):
-            raise BioFlowInsightError(f"An odd number of '\"\"\"' was found in the code.", num = 16, origin=self)
+            raise BioFlowInsightError(f"An odd number of '\"\"\"' was found in the code.", type = 16, origin=self)
         
 
 
@@ -119,7 +119,7 @@ class Nextflow_File(Nextflow_Building_Blocks):
         for fun in self.functions:
             if(name==fun.get_alias()):
                 return fun
-        raise BioFlowInsightError(f"'{name}' is expected to be defined in the file, but it could not be found.", num = 18, origin=self)
+        raise BioFlowInsightError(f"'{name}' is expected to be defined in the file, but it could not be found.", type = 18, origin=self)
 
     def get_modules_defined(self):
         return self.get_processes()+self.get_subworkflows()+self.get_functions()+self.get_modules_included()
diff --git a/src/operation.py b/src/operation.py
index 42ddcf3..9be8afa 100644
--- a/src/operation.py
+++ b/src/operation.py
@@ -182,7 +182,7 @@ class Operation(Executor):
                 else:
                     if(name_called[:5]=="Call_"):
                         name_called = self.calls[name_called].get_code()
-                    raise BioFlowInsightError(f"The call for '{name_called}' coudn't be found, before its use in the operation '{self.get_code(get_OG=True)}'{self.get_string_line(self.get_code(get_OG=True))}. Either because the call wasn't made before the operation or that the element it is calling doesn't exist.", num =8, origin=self)
+                    raise BioFlowInsightError(f"The call for '{name_called}' coudn't be found, before its use in the operation '{self.get_code(get_OG=True)}'{self.get_string_line(self.get_code(get_OG=True))}. Either because the call wasn't made before the operation or that the element it is calling doesn't exist.", type =8, origin=self)
                     
 
                 
@@ -333,7 +333,7 @@ class Operation(Executor):
 
         #Case tupel with call -> this is not supported by BioFlow-Insight -> try calling first then using the emits
         if(bool(re.fullmatch(r"\( *\w+ *(\, *\w+)+ *\) *= *Call_\d+", operation.strip()))):
-            raise BioFlowInsightError(f"A tuple is associated with an call{self.get_string_line(self.get_code(get_OG= True))}. BioFlow-Insight doesn't support this (see specification list), try defining the operation in a different way.", num=9, origin=self)
+            raise BioFlowInsightError(f"A tuple is associated with an call{self.get_string_line(self.get_code(get_OG= True))}. BioFlow-Insight doesn't support this (see specification list), try defining the operation in a different way.", type=9, origin=self)
 
         searching_for_emits = True
         while(searching_for_emits):
@@ -501,7 +501,7 @@ class Operation(Executor):
             #================================
             pattern= constant.TUPLE_EMIT
             for match in re.finditer(pattern, operation):
-                raise BioFlowInsightError(f"A tuple is associated with an emit{self.get_string_line(self.get_code(clean_pipe = False))}. BioFlow-Insight doesn't support this (see specification list), try defining the operation in a different way.", num=7, origin=self)
+                raise BioFlowInsightError(f"A tuple is associated with an emit{self.get_string_line(self.get_code(clean_pipe = False))}. BioFlow-Insight doesn't support this (see specification list), try defining the operation in a different way.", type=7, origin=self)
 
 
 
@@ -822,7 +822,7 @@ class Operation(Executor):
         if(self.check_if_double_dot()):
             self.initialise_double_dot()
         elif(bool(re.fullmatch(constant.DOUBLE_DOT_TUPLE, self.get_code(clean_pipe = False)))):
-            raise BioFlowInsightError(f"A ternary conditional operator was used with an tuple{self.get_string_line(self.get_code(clean_pipe = False))}. BioFlow-Insight doesn't support this yet (see specification list), try defining the operation in a different way.", num=5, origin=self)
+            raise BioFlowInsightError(f"A ternary conditional operator was used with an tuple{self.get_string_line(self.get_code(clean_pipe = False))}. BioFlow-Insight doesn't support this yet (see specification list), try defining the operation in a different way.", type=5, origin=self)
         else:
             self.extract_calls()
             self.initialise_origins()
@@ -897,7 +897,7 @@ class Operation(Executor):
                 elif(call.get_first_element_called().get_type()=="Subworkflow"):
                     sub = call.get_first_element_called()
                     if(sub.get_nb_emit()==0):
-                        raise BioFlowInsightError(f"The subworkflow '{sub.get_name()}' doesn't emit anything. It is given to an operation{self.get_string_line(call.get_code())}.", num=20, origin=self)
+                        raise BioFlowInsightError(f"The subworkflow '{sub.get_name()}' doesn't emit anything. It is given to an operation{self.get_string_line(call.get_code())}.", type=20, origin=self)
                     elif(sub.get_nb_emit()>1):
                         #In the case test().a.view() and test is a subworkflow
                         added = False
@@ -916,7 +916,7 @@ class Operation(Executor):
                                         added =True
                         
                         if(not added):
-                            raise BioFlowInsightError(f"To much to unpack : The subworkflow '{sub.get_name()}' emits over one channel in a operation{self.get_string_line(call.get_code())}.", num=20, origin=self)
+                            raise BioFlowInsightError(f"To much to unpack : The subworkflow '{sub.get_name()}' emits over one channel in a operation{self.get_string_line(call.get_code())}.", type=20, origin=self)
                         #TODO recommendation -> try using an emit subworkflow.out
                     else:
                         emit = sub.get_emit()[0]
diff --git a/src/outils.py b/src/outils.py
index 32c7aa9..ea78ff6 100644
--- a/src/outils.py
+++ b/src/outils.py
@@ -911,7 +911,7 @@ def check_file_exists(address, origin):
             contents = f.read()
             return contents
     except Exception:
-        raise BioFlowInsightError(f"No such file: '{address}'.", num = 10,origin=origin)
+        raise BioFlowInsightError(f"No such file: '{address}'.", type = 10,origin=origin)
     
 
 def is_git_directory(path = '.'):
@@ -1151,17 +1151,18 @@ def operation_2_DSL2(code, origin):
     code = re.sub(r'\.\s*spread\s*\(', replace_spread_by_combine, code)
 
     if(bool(re.findall(r"\.\s*spread\s*\(", code))):
-        raise BioFlowInsightError(f"spread is not supported", num = -1, origin=origin)
+        raise BioFlowInsightError(f'The operator "spread" is not supported by the DSL1 Conversion', type = "DSL1 Conversion Error", origin=origin)
     if(bool(re.findall(r"\.\s*choice", code))):
-        raise BioFlowInsightError(f"choice is not supported", num = -2, origin=origin)
+        raise BioFlowInsightError(f'The operator "choice" is not supported by the DSL1 Conversion', type = "DSL1 Conversion Error", origin=origin)
     if(bool(re.findall(r"\.\s*countBy", code))):
-        raise BioFlowInsightError(f"countBy is not supported", num = -3, origin=origin)
+        raise BioFlowInsightError(f'The operator "countBy" is not supported by the DSL1 Conversion', type = "DSL1 Conversion Error", origin=origin)
     if(bool(re.findall(r"\.\s*fork", code))):
-        raise BioFlowInsightError(f"fork is not supported", num = -4, origin=origin)
+        raise BioFlowInsightError(f'The operator "fork" is not supported by the DSL1 Conversion', type = "DSL1 Conversion Error", origin=origin)
     if(bool(re.findall(r"\.\s*route", code))):
-        raise BioFlowInsightError(f"route is not supported", num = -5, origin=origin)
+        raise BioFlowInsightError(f'The operator "route" is not supported by the DSL1 Conversion', type = "DSL1 Conversion Error", origin=origin)
     if(bool(re.findall(r"\.\s*separate", code))):
-        raise BioFlowInsightError(f"separate is not supported", num = -6, origin=origin)
+        raise BioFlowInsightError(f'The operator "separate" is not supported by the DSL1 Conversion', type = "DSL1 Conversion Error", origin=origin)
+
     
 
     #Imporant it's last 
diff --git a/src/outils_graph.py b/src/outils_graph.py
index 4200be0..878a10d 100644
--- a/src/outils_graph.py
+++ b/src/outils_graph.py
@@ -140,12 +140,12 @@ def fill_dot_2(dot, dico, label_node = True, label_edge = True):
             c.attr(label=sub)
 
 def generate_pos_graph(filename, dico, relevant_nodes = -1, render_graphs = True):
-    dot = graphviz.Digraph()
-    dot.attr(rankdir='LR')
-    fill_dot(dot, dico, False, False)
-    dot.format = 'dot'
-    dot.render(filename=f'{filename}_pos')
     if(render_graphs):
+        dot = graphviz.Digraph()
+        dot.attr(rankdir='LR')
+        fill_dot(dot, dico, False, False)
+        dot.format = 'dot'
+        dot.render(filename=f'{filename}_pos')
         dot.render(filename=f'{filename}_pos', outfile=f'{filename}_pos.png')
     
 
diff --git a/src/process.py b/src/process.py
index 44a144c..d73f94f 100644
--- a/src/process.py
+++ b/src/process.py
@@ -185,7 +185,7 @@ class Process(Nextflow_Building_Blocks):
         temp_code = re.sub(constant.PROCESS_HEADER, "", code)
         temp_code = temp_code[:-1].strip()
         if(len(temp_code)==0):
-            raise BioFlowInsightError(f"The process '{self.get_name()}' defined in the file '{self.get_file_address()}' is an empty process!", num = 22, origin=self)
+            raise BioFlowInsightError(f"The process '{self.get_name()}' defined in the file '{self.get_file_address()}' is an empty process!", type = 22, origin=self)
     
         publishDir_multiple, publishDir_pos= False, (0, 0)
         for match in re.finditer(r"publishDir", code):
@@ -197,21 +197,21 @@ class Process(Nextflow_Building_Blocks):
         input_multiple, input_pos= False, (0, 0)
         for match in re.finditer(constant.INPUT, code):
             if(input_multiple):
-                raise BioFlowInsightError(f"Multiple 'input:' were found in the process '{self.get_name()}'.", num = 22, origin=self)
+                raise BioFlowInsightError(f"Multiple 'input:' were found in the process '{self.get_name()}'.", type = 22, origin=self)
             input_pos = match.span(0)
             input_multiple = True
 
         output_multiple, output_pos= False, (0, 0)
         for match in re.finditer(constant.OUTPUT, code):
             if(output_multiple):
-                raise BioFlowInsightError(f"Multiple 'output:' were found in the process '{self.get_name()}'?", num = 22, origin=self)
+                raise BioFlowInsightError(f"Multiple 'output:' were found in the process '{self.get_name()}'?", type = 22, origin=self)
             output_pos = match.span(0)
             output_multiple = True
 
         when_multiple, when_pos= False, (0, 0)
         for match in re.finditer(constant.WHEN, code):
             if(when_multiple):
-                raise BioFlowInsightError(f"Multiple 'when:' were found in the process '{self.get_name()}'.", num = 22, origin=self)
+                raise BioFlowInsightError(f"Multiple 'when:' were found in the process '{self.get_name()}'.", type = 22, origin=self)
             when_pos = match.span(0)
             when_multiple = True
 
@@ -486,7 +486,9 @@ class Process(Nextflow_Building_Blocks):
         lines = []
         for line in code.split("\n"):
             if(" def " in " "+line):
-                raise BioFlowInsightError(f"[DSL1 converter error] Do not recognise the input '{line.strip()}' in the process '{self.get_name()}'. Try rewritting it in a different way.")
+                raise BioFlowInsightError(f"Do not recognise the input '{line.strip()}' in the process '{self.get_name()}'. Try rewritting it in a different way.", type="DSL1 Conversion Error")
+            if(re.fullmatch(r"params\.\w+", line.strip())):
+                raise BioFlowInsightError(f"Cannot convert '{line.strip()}' in the process '{self.get_name()}'. Try rewritting it in a different way.", type="DSL1 Conversion Error")
             temp = process_2_DSL2(line.split(" from ")[0]) 
             lines.append(temp)
             #TODO -> need to determine if it's on it's own is it either a path or val
diff --git a/src/root.py b/src/root.py
index f5306bb..8d9909d 100644
--- a/src/root.py
+++ b/src/root.py
@@ -471,7 +471,7 @@ class Root(Nextflow_Building_Blocks):
                                                 if(start==0):
                                                     added = True
                                     if(not added):
-                                        raise BioFlowInsightError(f"In the executor '{txt_call}', '{first_thing_called}' is neither a process, subworkflow or an operator{self.get_string_line(txt_call)}", num = 14, origin=self)
+                                        raise BioFlowInsightError(f"In the executor '{txt_call}', '{first_thing_called}' is neither a process, subworkflow or an operator{self.get_string_line(txt_call)}", type = 14, origin=self)
                                     else:
                                         ope = Operation(code =txt_call, origin =self)
                                         self.executors.append(ope)
@@ -527,7 +527,7 @@ class Root(Nextflow_Building_Blocks):
                                     temp = text[start-10:end+10]
                                 except:
                                     temp = text[start:end]
-                                raise BioFlowInsightError(f"Failed to extract the operation or call{self.get_string_line(temp)}. Try rewriting it in a simplified version.", num = 11, origin=self)
+                                raise BioFlowInsightError(f"Failed to extract the operation or call{self.get_string_line(temp)}. Try rewriting it in a simplified version.", type = 11, origin=self)
                             
                             pot = expand_to_pipe_operators(text, pot)
                             #IF the exact potential hasn't already been searched, then we don't do it
@@ -549,7 +549,7 @@ class Root(Nextflow_Building_Blocks):
                                                     ope = Operation(code =pot, origin =self)
                                                     self.executors.append(ope)
                                                 else:
-                                                    raise BioFlowInsightError(f"'{first_thing_called}' is neither a process, subworkflow or an operator. In the executor '{pot}'{self.get_string_line(pot)}.", num=14,origin=self)#TODO -> try rewriting the operation using the standard syntaxe
+                                                    raise BioFlowInsightError(f"'{first_thing_called}' is neither a process, subworkflow or an operator. In the executor '{pot}'{self.get_string_line(pot)}.", type=14,origin=self)#TODO -> try rewriting the operation using the standard syntaxe
                                             
                                             else:
                                                 from .executor import Executor
@@ -625,7 +625,7 @@ class Root(Nextflow_Building_Blocks):
                         if(added):
                             break
                         elif(not added):
-                            raise BioFlowInsightError(f"In the executor '{txt_call}', '{first_thing_called}' is neither a process, subworkflow or an operator (in the file '{self.get_file_address()}')", num = 14,origin=self)
+                            raise BioFlowInsightError(f"In the executor '{txt_call}', '{first_thing_called}' is neither a process, subworkflow or an operator (in the file '{self.get_file_address()}')", type = 14,origin=self)
         
         #---------------------------------------------------------------------
         #STEP5 - We remove the things which were falsy extracted as executors
diff --git a/src/subworkflow.py b/src/subworkflow.py
index 7fc58c9..713ec15 100644
--- a/src/subworkflow.py
+++ b/src/subworkflow.py
@@ -200,21 +200,21 @@ class Subworkflow(Main):
         take_multiple, take_pos= False, (0, 0)
         for match in re.finditer(constant.TAKE, code):
             if(take_multiple):
-                raise BioFlowInsightError(f"Multiple 'take:' were found in the subworkflow '{self.get_name()}'.", num = 22, origin=self)
+                raise BioFlowInsightError(f"Multiple 'take:' were found in the subworkflow '{self.get_name()}'.", type = 22, origin=self)
             take_pos = match.span(0)
             take_multiple = True
 
         main_multiple, main_pos= False, (0, 0)
         for match in re.finditer(constant.MAIN, code):
             if(main_multiple):
-                raise BioFlowInsightError(f"Multiple 'main:' were found in the subworkflow '{self.get_name()}'.", num = 22, origin=self)
+                raise BioFlowInsightError(f"Multiple 'main:' were found in the subworkflow '{self.get_name()}'.", type = 22, origin=self)
             main_pos = match.span(0)
             main_multiple = True
 
         emit_multiple, emit_pos= False, (0, 0)
         for match in re.finditer(constant.EMIT_SUBWORKFLOW, code):
             if(emit_multiple):
-                raise BioFlowInsightError(f"Multiple 'emit:' were found in the subworkflow '{self.get_name()}'. ", num = 22, origin=self)
+                raise BioFlowInsightError(f"Multiple 'emit:' were found in the subworkflow '{self.get_name()}'. ", type = 22, origin=self)
             emit_pos = match.span(0)
             emit_multiple = True
 
@@ -291,7 +291,7 @@ class Subworkflow(Main):
                         channel.add_source(ope)
                         #ope.initialise_from_subworkflow_take()
                     else:
-                        raise BioFlowInsightError(f"The channel '{code[i]}' is already defined somewhere else in the subworkflow ('{self.get_name()}') or in the file.", num=4, origin=self)
+                        raise BioFlowInsightError(f"The channel '{code[i]}' is already defined somewhere else in the subworkflow ('{self.get_name()}') or in the file.", type=4, origin=self)
                     tab.append(ope)
                     for channel in ope.get_gives():
                         self.takes_channels.append(channel)
diff --git a/src/workflow.py b/src/workflow.py
index dd66787..35d9e9c 100644
--- a/src/workflow.py
+++ b/src/workflow.py
@@ -42,7 +42,7 @@ class Workflow:
         if(not os.path.isfile(file)):
             nextflow_files = glob.glob(f'{file}/*.nf')
             if(len(nextflow_files)==0):
-                raise BioFlowInsightError("No Nextflow files ('.nf') are in the directory!", num = -1)
+                raise BioFlowInsightError("No Nextflow files ('.nf') are in the directory!", type = -1)
             txt = ""
             #Try to read the main.nf file -> if this cannot be found then the first nextflow file is used
             try:
@@ -509,7 +509,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
         for match in re.finditer(constant.FULL_INLCUDE_2, code):
             full_include = match.group(0)
             for temp in re.finditer(fr"{re.escape(full_include)} *addParams\(", code):
-                raise BioFlowInsightError("There is an 'addParams' in an include. BioFlow-Insight doesn not how to rewrite this.")
+                raise BioFlowInsightError("There is an 'addParams' in an include. BioFlow-Insight doesn not how to rewrite this.", type="Rewrite Error")
             code = re.sub(fr"{re.escape(full_include)}.*", "", code)
 
         processes, subworkflows, functions = [], [], []
-- 
GitLab