Skip to content

Commit

Permalink
Merge pull request #36 from MeasureAuthoringTool/MAT-7995_updateError…
Browse files Browse the repository at this point in the history
…MsgWhenDefineLacksName

Mat 7995 update error msg when define lacks name
  • Loading branch information
sb-cecilialiu authored Dec 17, 2024
2 parents 63a2eab + 27af4db commit e06a562
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public List<CqlCompilerException> filter() {

filteredList = filterBySyntax(filteredCqlTranslatorExceptions);
if (CollectionUtils.isNotEmpty(filteredList)) {
newList.addAll(filteredList);
newList.addAll(filterOutCustomErrors(filteredList));
}
return newList;
}
Expand Down Expand Up @@ -111,4 +111,20 @@ private List<CqlCompilerException> filterBySyntax(
.contains("org.cqframework.cql.cql2elm.CqlSyntaxException"))
.toList();
}

/*
* 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> filterOutCustomErrors(
List<CqlCompilerException> filteredCqlTranslatorExceptions) {
return filteredCqlTranslatorExceptions.stream()
.filter(
cqlCompilerException ->
!"no viable alternative at input 'define :'"
.equalsIgnoreCase(cqlCompilerException.getMessage()))
.toList();
}
}

0 comments on commit e06a562

Please sign in to comment.