Skip to content

Commit

Permalink
fix: parse error messages for mutation filter expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
fengelniederhammer committed Jul 12, 2023
1 parent e0e2219 commit 9e4612d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/silo/query_engine/actions/aa_mutations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ QueryResult AAMutations::execute(
void from_json(const nlohmann::json& json, std::unique_ptr<AAMutations>& action) {
CHECK_SILO_QUERY(
json.contains("sequenceName") && json["sequenceName"].is_string(),
"AminoAcideMutations action must have the field sequenceName:string"
"AminoAcidMutations action must have the string field sequenceName"
)
const std::string aa_sequence_name = json["sequenceName"].get<std::string>();
double min_proportion = AAMutations::DEFAULT_MIN_PROPORTION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void from_json(const nlohmann::json& json, std::unique_ptr<AASymbolEquals>& filt
CHECK_SILO_QUERY(
json.contains("sequenceName") && json["sequenceName"].is_string(),
"AminoAcidEquals expression requires the string field sequenceName"
"integer"
)
CHECK_SILO_QUERY(
json.is_object() && json.contains("position"),
Expand Down
4 changes: 1 addition & 3 deletions src/silo/query_engine/filter_expressions/has_aa_mutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ void from_json(const nlohmann::json& json, std::unique_ptr<HasAAMutation>& filte
)
CHECK_SILO_QUERY(
json["position"].is_number_unsigned(),
"The field 'position' in a HasAminoAcidMutation expression needs to be an unsigned "
"integer"
"The field 'position' in a HasAminoAcidMutation expression needs to be an unsigned integer"
)
CHECK_SILO_QUERY(
json.contains("sequenceName") && json["sequenceName"].is_string(),
"HasAminoAcidMutation expression requires the string field sequenceName"
"integer"
)
const std::string aa_sequence_name = json["sequenceName"].get<std::string>();
const uint32_t position = json["position"].get<uint32_t>() - 1;
Expand Down
3 changes: 1 addition & 2 deletions src/silo/query_engine/filter_expressions/has_mutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ void from_json(const nlohmann::json& json, std::unique_ptr<HasMutation>& filter)
)
CHECK_SILO_QUERY(
json["position"].is_number_unsigned(),
"The field 'position' in a HasNucleotideMutation expression needs to be an unsigned "
"integer"
"The field 'position' in a HasNucleotideMutation expression needs to be an unsigned integer"
)
std::optional<std::string> nuc_sequence_name;
if (json.contains("sequenceName")) {
Expand Down

0 comments on commit 9e4612d

Please sign in to comment.