Skip to content

Commit d6c6678

Browse files
committed
Avoid rethrowing exception
1 parent ac2634e commit d6c6678

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Bonsai.Scripting.Expressions.Design/CaretExpressionAnalyzer.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,15 @@ public Type ParseExpressionType(Type itType, out bool isClassIdentifier)
9797
? DynamicExpressionParser.ParseLambda(_parsingConfig, itType, null, primaryText).ReturnType
9898
: null;
9999
}
100-
catch (ParseException pex)
100+
catch (ParseException)
101101
{
102102
isClassIdentifier = true;
103-
return PredefinedTypeKeywords.TryGetValue(primaryText, out Type type)
104-
? type
105-
: PredefinedTypes.Append(itType).FirstOrDefault(type => primaryText.Equals(type.Name))
106-
?? throw pex;
103+
if (PredefinedTypeKeywords.TryGetValue(primaryText, out Type keywordType))
104+
return keywordType;
105+
else if (PredefinedTypes.Append(itType).FirstOrDefault(type => primaryText.Equals(type.Name)) is Type type)
106+
return type;
107+
else
108+
throw;
107109
}
108110
}
109111

0 commit comments

Comments
 (0)