abstract_core/objects/validation/
error.rs

1use cosmwasm_std::StdError;
2use thiserror::Error;
3
4use super::verifiers::DANGEROUS_CHARS;
5
6#[derive(Error, Debug, PartialEq)]
7pub enum ValidationError {
8    #[error("{0}")]
9    Std(#[from] StdError),
10
11    #[error("description too short, must be at least {0} characters")]
12    DescriptionInvalidShort(usize),
13
14    #[error("description too long, must be at most {0} characters")]
15    DescriptionInvalidLong(usize),
16
17    #[error(
18        "description contains dangerous characters, including one of {:?}",
19        DANGEROUS_CHARS
20    )]
21    DescriptionContainsDangerousCharacters {},
22
23    #[error("link too short, must be at least {0} characters")]
24    LinkInvalidShort(usize),
25
26    #[error("link too long, must be at most {0} characters")]
27    LinkInvalidLong(usize),
28
29    #[error("link must start with http:// or https://")]
30    LinkInvalidFormat {},
31
32    #[error(
33        "link contains dangerous characters, including one of {:?}",
34        DANGEROUS_CHARS
35    )]
36    LinkContainsDangerousCharacters {},
37
38    #[error("title/gov-type too short, must be at least {0} characters")]
39    TitleInvalidShort(usize),
40
41    #[error("title/gov-type too long, must be at most {0} characters")]
42    TitleInvalidLong(usize),
43
44    #[error(
45        "title/gov-type contains dangerous characters, including one of {:?}",
46        DANGEROUS_CHARS
47    )]
48    TitleContainsDangerousCharacters {},
49}