sugar_cli/validate/
errors.rs

1use serde::Serialize;
2use thiserror::Error;
3
4#[derive(Debug, Error, Serialize)]
5pub enum ValidateParserError {
6    #[error("Missing or empty assets directory")]
7    MissingOrEmptyAssetsDirectory,
8
9    #[error("Invalid assets directory")]
10    InvalidAssetsDirectory,
11
12    #[error("Name exceeds 32 chars.")]
13    NameTooLong,
14
15    #[error("Symbol exceeds 10 chars.")]
16    SymbolTooLong,
17
18    #[error("Url exceeds 200 chars.")]
19    UrlTooLong,
20
21    #[error("Creator address: '{0}' is invalid.")]
22    InvalidCreatorAddress(String),
23
24    #[error("Combined creators' share does not equal 100%.")]
25    InvalidCreatorShare,
26
27    #[error("Seller fee basis points value '{0}' is invalid: must be between 0 and 10,000.")]
28    InvalidSellerFeeBasisPoints(u16),
29
30    #[error("Missing animation url field")]
31    MissingAnimationUrl,
32
33    #[error("Missing external url field")]
34    MissingExternalUrl,
35
36    #[error("Missing collection field")]
37    MissingCollection,
38
39    #[error("Missing creators field")]
40    MissingCreators,
41
42    #[error("Missing seller fee basis points field")]
43    MissingSellerFeeBasisPoints,
44
45    #[error("Unexpected files found in assets directory")]
46    UnexpectedFilesFound,
47
48    #[error("No assets found in assets directory")]
49    NoAssetsFound,
50
51    #[error("Redundant file {0}.json")]
52    RedundantFile(usize),
53
54    #[error("File {0}.json is out of expected range")]
55    FileOutOfRange(usize),
56
57    #[error("Assets list isn't continuous please check files")]
58    NonContinuousSeries,
59
60    #[error("Invalid category '{0}': must be one of: {1}")]
61    InvalidCategory(String, String),
62}