mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
feat(analytics): Add Clickhouse based analytics (#2988)
Co-authored-by: harsh_sharma_juspay <harsh.sharma@juspay.in> Co-authored-by: Ivor Dsouza <ivor.dsouza@juspay.in> Co-authored-by: Chethan Rao <70657455+Chethan-rao@users.noreply.github.com> Co-authored-by: nain-F49FF806 <126972030+nain-F49FF806@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: akshay.s <akshay.s@juspay.in> Co-authored-by: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com>
This commit is contained in:
32
crates/analytics/src/errors.rs
Normal file
32
crates/analytics/src/errors.rs
Normal file
@ -0,0 +1,32 @@
|
||||
use api_models::errors::types::{ApiError, ApiErrorResponse};
|
||||
use common_utils::errors::{CustomResult, ErrorSwitch};
|
||||
|
||||
pub type AnalyticsResult<T> = CustomResult<T, AnalyticsError>;
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, thiserror::Error)]
|
||||
pub enum AnalyticsError {
|
||||
#[allow(dead_code)]
|
||||
#[error("Not implemented: {0}")]
|
||||
NotImplemented(&'static str),
|
||||
#[error("Unknown Analytics Error")]
|
||||
UnknownError,
|
||||
}
|
||||
|
||||
impl ErrorSwitch<ApiErrorResponse> for AnalyticsError {
|
||||
fn switch(&self) -> ApiErrorResponse {
|
||||
match self {
|
||||
Self::NotImplemented(feature) => ApiErrorResponse::NotImplemented(ApiError::new(
|
||||
"IR",
|
||||
0,
|
||||
format!("{feature} is not implemented."),
|
||||
None,
|
||||
)),
|
||||
Self::UnknownError => ApiErrorResponse::InternalServerError(ApiError::new(
|
||||
"HE",
|
||||
0,
|
||||
"Something went wrong",
|
||||
None,
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user