Skip to content

Commit

Permalink
MAT-7995 filter out err msg when define lacks name
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-cecilialiu committed Dec 17, 2024
1 parent 63a2eab commit 59dd4d3
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ public List<CqlCompilerException> filter() {

filteredList = filterBySyntax(filteredCqlTranslatorExceptions);
if (CollectionUtils.isNotEmpty(filteredList)) {
newList.addAll(filteredList);
newList.addAll(filterOutCustomErrors(filteredList));
}
return newList;
}

/*
* MAT-7995: error: "No Viable Input at 'define :'"
* should be customized as: "Definition is missing a name."
* This is done in cql-antlr-parse, so on the frontend we don't want a duplicate error message
* therefore we are filtering it out here.
*/
private List<CqlCompilerException> filterOutWarnings() {
if (showWarnings) {
return cqlTranslatorExceptions;
Expand Down Expand Up @@ -111,4 +117,14 @@ private List<CqlCompilerException> filterBySyntax(
.contains("org.cqframework.cql.cql2elm.CqlSyntaxException"))
.toList();
}

private List<CqlCompilerException> filterOutCustomErrors(
List<CqlCompilerException> filteredCqlTranslatorExceptions) {
return filteredCqlTranslatorExceptions.stream()
.filter(
cqlCompilerException ->
!"no viable alternative at input 'define :'"
.equalsIgnoreCase(cqlCompilerException.getMessage()))
.toList();
}
}

0 comments on commit 59dd4d3

Please sign in to comment.