Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(taxonomies): fix error messages #2591

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions components/templates/src/global_fns/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,9 @@ impl TeraFn for GetTaxonomyTerm {
)
.unwrap_or(true);

let lang = optional_arg!(
String,
args.get("lang"),
"`get_taxonomy_term_by_name`: `lang` must be a string"
)
.unwrap_or_else(|| self.default_lang.clone());
let lang =
optional_arg!(String, args.get("lang"), "`get_taxonomy_term`: `lang` must be a string")
.unwrap_or_else(|| self.default_lang.clone());

let tax: &Taxonomy = match (self.taxonomies.get(&format!("{}-{}", kind, lang)), required) {
(Some(t), _) => t,
Expand All @@ -327,7 +324,7 @@ impl TeraFn for GetTaxonomyTerm {
}
(None, true) => {
return Err(format!(
"`get_taxonomy_term_by_name` received an unknown taxonomy as kind: {}",
"`get_taxonomy_term` received an unknown taxonomy as kind: {}",
kind
)
.into());
Expand All @@ -340,11 +337,9 @@ impl TeraFn for GetTaxonomyTerm {
return Ok(Value::Null);
}
(None, true) => {
return Err(format!(
"`get_taxonomy_term_by_name` received an unknown taxonomy as kind: {}",
kind
)
.into());
return Err(
format!("`get_taxonomy_term` received an unknown term: {}", term).into()
);
}
};

Expand Down