mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
enhan(errors): make StorageErrorExt generic on errors (#928)
This commit is contained in:
@ -1,20 +1,16 @@
|
|||||||
use crate::{core::errors, logger};
|
use crate::{core::errors, logger};
|
||||||
|
|
||||||
pub trait StorageErrorExt<T> {
|
pub trait StorageErrorExt<T, E> {
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn to_not_found_response(
|
fn to_not_found_response(self, not_found_response: E) -> error_stack::Result<T, E>;
|
||||||
self,
|
|
||||||
not_found_response: errors::ApiErrorResponse,
|
|
||||||
) -> error_stack::Result<T, errors::ApiErrorResponse>;
|
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn to_duplicate_response(
|
fn to_duplicate_response(self, duplicate_response: E) -> error_stack::Result<T, E>;
|
||||||
self,
|
|
||||||
duplicate_response: errors::ApiErrorResponse,
|
|
||||||
) -> error_stack::Result<T, errors::ApiErrorResponse>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> StorageErrorExt<T> for error_stack::Result<T, errors::StorageError> {
|
impl<T> StorageErrorExt<T, errors::ApiErrorResponse>
|
||||||
|
for error_stack::Result<T, errors::StorageError>
|
||||||
|
{
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn to_not_found_response(
|
fn to_not_found_response(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user