Improve error message on 'ParameterizedValidator'.

This commit is contained in:
KtorZ 2023-04-05 11:55:05 +02:00
parent cdc7ebf9a0
commit f311e048b7
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 5 additions and 2 deletions

View File

@ -37,8 +37,11 @@ pub enum Error {
)]
#[diagnostic(code("aiken::blueprint::address::parameterized"))]
#[diagnostic(help(
"I can only compute addresses of validators that are fully applied. For example, a {keyword_spend} validator must have exactly 3 arguments: a datum, a redeemer and a context. If it has more, they need to be provided beforehand and applied directly in the validator. Applying parameters change the validator's compiled code, and thus the address.\n\nThis is why I need you to apply parameters first.",
keyword_spend = "spend".if_supports_color(Stdout, |s| s.purple())))]
"I can only compute addresses of validators that are fully applied. For example, a {keyword_spend} validator must have exactly {spend_arity} arguments: a datum, a redeemer and a context. If it has more, they need to be provided beforehand and applied directly to the validator.\n\nApplying parameters change the validator's compiled code, and thus the address. This is why I need you to apply parameters first using the {blueprint_apply_command} command.",
keyword_spend = "spend".if_supports_color(Stdout, |s| s.yellow()),
spend_arity = "3".if_supports_color(Stdout, |s| s.yellow()),
blueprint_apply_command = "blueprint apply".if_supports_color(Stdout, |s| s.purple()),
))]
ParameterizedValidator { n: usize },
}