Skip to content
Snippets Groups Projects
Commit 9babd60c authored by George Marchment's avatar George Marchment
Browse files

add small error handling

parent 7f174dc5
No related branches found
No related tags found
1 merge request!7Return non zero code on failure
Pipeline #13260 failed with stage
in 42 seconds
......@@ -43,6 +43,8 @@ class BioFlowInsightError(Exception):
#* [5] -> A ternary conditional operator was used with an tuple
#* [7] -> Tuple with emit (ch1, ch2) = emit.out
#* [9] -> Tuple with call (ch1, ch2) = wf()
#* [11] -> Failed to extract the operation or call at the line x. Try rewriting it in a simplified version.
......
......@@ -318,16 +318,24 @@ class Nextflow_Building_Blocks:
if(match.group(1) in constant.LIST_OPERATORS):
#TODO -> the function below might not work perfectly but i don't have any other ideas
#TODO -> IMPORTANT find another way of doing this -> for example if there isn't the same number of curlies/parentheses
#Use if there is an operator called right before opening the curlies/parenthse
curly_left, curly_right = get_curly_count(text[:start]), get_curly_count(text[end:])
#curly_left, curly_right = get_curly_count(text[:start]), get_curly_count(text[end:])
parenthese_left, parenthese_right = get_parenthese_count(text[:start]), get_parenthese_count(text[end:])
#if(curly_left==0 and curly_right==0 and parenthese_left==0 and parenthese_right==0 and (start, end) not in searched):
if(parenthese_left==0 and parenthese_right==0 and (start, end) not in searched):
searched.append((start, end))
pot = extract_executor_from_middle(text, start, end)
try:
pot = extract_executor_from_middle(text, start, end)
except:
try:
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)
pot = expand_to_pipe_operators(text, pot)
#If the thing which is extracted is not in the conditon of an if
......@@ -360,6 +368,7 @@ class Nextflow_Building_Blocks:
self.executors.append(ope)
searching = True
break
#---------------------------------------------------------------
#STEP4 - Extract the Executors which only use the pipe operators (which start with a channel)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment