refactor(errors): error enums to use 'static str (#472)

This commit is contained in:
Narayan Bhat
2023-01-30 18:57:05 +05:30
committed by GitHub
parent fa7d087c0d
commit 24351a6c85
25 changed files with 84 additions and 79 deletions

View File

@ -54,8 +54,11 @@ pub enum StorageError {
DatabaseError(error_stack::Report<storage_errors::DatabaseError>),
#[error("ValueNotFound: {0}")]
ValueNotFound(String),
#[error("DuplicateValue: {0}")]
DuplicateValue(String),
#[error("DuplicateValue: {entity} already exists {key:?}")]
DuplicateValue {
entity: &'static str,
key: Option<String>,
},
#[error("KV error")]
KVError,
#[error("Serialization failure")]
@ -224,7 +227,7 @@ pub enum ConnectorError {
#[error("Failed to handle connector response")]
ResponseHandlingFailed,
#[error("Missing required field: {field_name}")]
MissingRequiredField { field_name: String },
MissingRequiredField { field_name: &'static str },
#[error("Failed to obtain authentication type")]
FailedToObtainAuthType,
#[error("Failed to obtain certificate")]
@ -274,7 +277,7 @@ pub enum VaultError {
#[error("The given payment method is currently not supported in vault")]
PaymentMethodNotSupported,
#[error("Missing required field: {field_name}")]
MissingRequiredField { field_name: String },
MissingRequiredField { field_name: &'static str },
#[error("The card vault returned an unexpected response: {0:?}")]
UnexpectedResponseError(bytes::Bytes),
}
@ -306,9 +309,9 @@ pub enum ProcessTrackerError {
#[error("Failed to fetch processes from database")]
ProcessFetchingFailed,
#[error("Failed while fetching: {resource_name}")]
ResourceFetchingFailed { resource_name: String },
ResourceFetchingFailed { resource_name: &'static str },
#[error("Failed while executing: {flow}")]
FlowExecutionError { flow: String },
FlowExecutionError { flow: &'static str },
#[error("Not Implemented")]
NotImplemented,
#[error("Job not found")]