sui_package_resolver/
error.rs1use std::sync::Arc;
5
6use move_binary_format::errors::VMError;
7use move_core_types::account_address::AccountAddress;
8use thiserror::Error;
9
10#[derive(Error, Debug, Clone)]
11pub enum Error {
12 #[error("{0}")]
13 Bcs(#[from] bcs::Error),
14
15 #[error("Store {} error: {}", store, error)]
16 Store { store: &'static str, error: String },
17
18 #[error("{0}")]
19 Deserialize(VMError),
20
21 #[error(
22 "Package has no modules: {}",
23 .0.to_canonical_display(true),
24 )]
25 EmptyPackage(AccountAddress),
26
27 #[error(
28 "Function not found: {}::{1}::{2}",
29 .0.to_canonical_display(true),
30 )]
31 FunctionNotFound(AccountAddress, String, String),
32
33 #[error(
34 "Linkage not found for package: {}",
35 .0.to_canonical_display(true),
36 )]
37 LinkageNotFound(AccountAddress),
38
39 #[error(
40 "Module not found: {}::{1}",
41 .0.to_canonical_display(true),
42 )]
43 ModuleNotFound(AccountAddress, String),
44
45 #[error(
46 "No origin package found for {}::{1}::{2}",
47 .0.to_canonical_display(true),
48 )]
49 NoTypeOrigin(AccountAddress, String, String),
50
51 #[error(
52 "Not a package: {}",
53 .0.to_canonical_display(true),
54 )]
55 NotAPackage(AccountAddress),
56
57 #[error("Not an identifier: '{0}'")]
58 NotAnIdentifier(String),
59
60 #[error(
61 "Package not found: {}",
62 .0.to_canonical_display(true),
63 )]
64 PackageNotFound(AccountAddress),
65
66 #[error(
67 "Datatype not found: {}::{1}::{2}",
68 .0.to_canonical_display(true),
69 )]
70 DatatypeNotFound(AccountAddress, String, String),
71
72 #[error("More than {0} struct definitions required to resolve type")]
73 TooManyTypeNodes(usize, usize),
74
75 #[error("Expected at most {0} type parameters, got {1}")]
76 TooManyTypeParams(usize, usize),
77
78 #[error("Expected {0} type parameters, but got {1}")]
79 TypeArityMismatch(usize, usize),
80
81 #[error("Type parameter nesting exceeded limit of {0}")]
82 TypeParamNesting(usize, usize),
83
84 #[error("Type Parameter {0} out of bounds ({1})")]
85 TypeParamOOB(u16, usize),
86
87 #[error("Unexpected reference type.")]
88 UnexpectedReference,
89
90 #[error("Unexpected type: 'signer'.")]
91 UnexpectedSigner,
92
93 #[error("Unexpected error: {0}")]
94 UnexpectedError(Arc<dyn std::error::Error + Send + Sync + 'static>),
95
96 #[error("Type layout nesting exceeded limit of {0}")]
97 ValueNesting(usize),
98}