Minor error messages fixes.

This commit is contained in:
KtorZ 2023-03-16 23:35:12 +01:00
parent 13890874c0
commit 0feb2df0a0
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 5 additions and 5 deletions

View File

@ -833,7 +833,7 @@ The best thing to do from here is to remove it."#))]
}, },
#[error( #[error(
"A validator must return {}", "A validator must return {}.\n",
"Bool" "Bool"
.if_supports_color(Stdout, |s| s.bright_blue()) .if_supports_color(Stdout, |s| s.bright_blue())
.if_supports_color(Stdout, |s| s.bold()) .if_supports_color(Stdout, |s| s.bold())
@ -855,10 +855,10 @@ The best thing to do from here is to remove it."#))]
return_type: Arc<Type>, return_type: Arc<Type>,
}, },
#[error("Validators require at least 2 arguments and at most 3 arguments.")] #[error("Validators require at least 2 arguments and at most 3 arguments.\n")]
#[diagnostic(code("illegal::validator_arity"))] #[diagnostic(code("illegal::validator_arity"))]
#[diagnostic(help( #[diagnostic(help(
"Validators require either 2 or 3 arguments {}.\nIf you don't need one of the required arguments use an underscore `_datum`.", "Please {}.\nIf you don't need one of the required arguments use an underscore (e.g. `_datum`).",
if *count < 2 { if *count < 2 {
let missing = 2 - count; let missing = 2 - count;
@ -869,7 +869,7 @@ The best thing to do from here is to remove it."#))]
} }
format!( format!(
"please add the {} missing {arguments}", "add the {} missing {arguments}",
missing.to_string().if_supports_color(Stdout, |s| s.yellow()), missing.to_string().if_supports_color(Stdout, |s| s.yellow()),
) )
} else { } else {
@ -882,7 +882,7 @@ The best thing to do from here is to remove it."#))]
} }
format!( format!(
"please remove the {} extra {arguments}", "remove the {} extra {arguments}",
extra.to_string().if_supports_color(Stdout, |s| s.yellow()), extra.to_string().if_supports_color(Stdout, |s| s.yellow()),
) )
} }