1use ic_cdk::call::RejectCode;
2use thiserror::Error;
3
4#[derive(Error, Debug, Clone, PartialEq, Eq)]
5pub enum Error {
6 #[error("The canister cycles balance retrieval failed")]
7 GetCanisterCycleBalanceFailed {
8 rejection_code: RejectCode,
9 rejection_message: String,
10 },
11 #[error("Failed to convert cycles {cycles} to u128.")]
12 FailedCyclesConversion { cycles: String },
13 #[error("Failed to get the metrics from the http request call.")]
14 MetricsHttpRequestFailed { code: RejectCode, reason: String },
15 #[error("Failed to deserialize the metrics response.")]
16 MetricsResponseDeserializationFailed,
17 #[error("The canister cycles balance metric was not found in the response.")]
18 CyclesBalanceMetricNotFound { metric_name: String },
19 #[error("Could not obtain cycles for topping up the funding canister.")]
20 ObtainCyclesError { details: String },
21}