dfx_core/error/
dfx_config.rs1use candid::Principal;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum AddDependenciesError {
6 #[error("Circular canister dependencies: {}", _0.join(" -> "))]
7 CanisterCircularDependency(Vec<String>),
8
9 #[error("Canister '{0}' not found in dfx.json.")]
10 CanisterNotFound(String),
11}
12
13#[derive(Error, Debug)]
14pub enum GetCanisterConfigError {
15 #[error("No canisters in the configuration file.")]
16 CanistersFieldDoesNotExist(),
17
18 #[error("Canister '{0}' not found in dfx.json.")]
19 CanisterNotFound(String),
20}
21
22#[derive(Error, Debug)]
23pub enum GetCanisterNamesWithDependenciesError {
24 #[error("No canisters in the configuration file.")]
25 CanistersFieldDoesNotExist(),
26
27 #[error("Failed to add dependencies for canister '{0}'")]
28 AddDependenciesFailed(String, #[source] AddDependenciesError),
29}
30
31#[derive(Error, Debug)]
32pub enum GetComputeAllocationError {
33 #[error("Failed to get compute allocation for canister '{0}'")]
34 GetComputeAllocationFailed(String, #[source] GetCanisterConfigError),
35}
36
37#[derive(Error, Debug)]
38pub enum GetFreezingThresholdError {
39 #[error("Failed to get freezing threshold for canister '{0}'")]
40 GetFreezingThresholdFailed(String, #[source] GetCanisterConfigError),
41}
42
43#[derive(Error, Debug)]
44pub enum GetReservedCyclesLimitError {
45 #[error("Failed to get reserved cycles limit for canister '{0}'")]
46 GetReservedCyclesLimitFailed(String, #[source] GetCanisterConfigError),
47}
48
49#[derive(Error, Debug)]
50pub enum GetMemoryAllocationError {
51 #[error("Failed to get memory allocation for canister '{0}'")]
52 GetMemoryAllocationFailed(String, #[source] GetCanisterConfigError),
53}
54
55#[derive(Error, Debug)]
56pub enum GetWasmMemoryLimitError {
57 #[error("Failed to get Wasm memory limit for canister '{0}'")]
58 GetWasmMemoryLimitFailed(String, #[source] GetCanisterConfigError),
59}
60
61#[derive(Error, Debug)]
62pub enum GetWasmMemoryThresholdError {
63 #[error("Failed to get Wasm memory threshold for canister '{0}'")]
64 GetWasmMemoryThresholdFailed(String, #[source] GetCanisterConfigError),
65}
66
67#[derive(Error, Debug)]
68pub enum GetLogVisibilityError {
69 #[error("Failed to get log visibility for canister '{0}'")]
70 GetLogVisibilityFailed(String, #[source] GetCanisterConfigError),
71}
72
73#[derive(Error, Debug)]
74pub enum GetPullCanistersError {
75 #[error("Pull dependencies '{0}' and '{1}' have the same canister ID: {2}")]
76 PullCanistersSameId(String, String, Principal),
77}
78
79#[derive(Error, Debug)]
80pub enum GetRemoteCanisterIdError {
81 #[error("Failed to figure out if canister '{0}' has a remote id on network '{1}'")]
82 GetRemoteCanisterIdFailed(Box<String>, Box<String>, #[source] GetCanisterConfigError),
83}
84
85#[derive(Error, Debug)]
86pub enum GetSpecifiedIdError {
87 #[error("Failed to get specified_id for canister '{0}'")]
88 GetSpecifiedIdFailed(String, #[source] GetCanisterConfigError),
89}