build(deps): bump error-stack from version 0.3.1 to 0.4.1 (#4188)

This commit is contained in:
Sanchith Hegde
2024-04-01 12:31:17 +05:30
committed by GitHub
parent cb2000b088
commit ea730d4ffc
286 changed files with 1361 additions and 2397 deletions

View File

@ -1,7 +1,7 @@
use common_utils::date_time;
#[cfg(feature = "email")]
use diesel_models::{api_keys::ApiKey, enums as storage_enums};
use error_stack::{report, IntoReport, ResultExt};
use error_stack::{report, ResultExt};
use masking::{PeekInterface, StrongSecret};
use router_env::{instrument, tracing};
@ -33,12 +33,10 @@ impl settings::ApiKeys {
HASH_KEY.get_or_try_init(|| {
<[u8; PlaintextApiKey::HASH_KEY_LEN]>::try_from(
hex::decode(self.hash_key.peek())
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("API key hash key has invalid hexadecimal data")?
.as_slice(),
)
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("The API hashing key has incorrect length")
.map(StrongSecret::new)
@ -165,7 +163,6 @@ pub async fn create_api_key(
add_api_key_expiry_task(store, &api_key, expiry_reminder_days)
.await
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to insert API key expiry reminder to process tracker")?;
}
@ -197,7 +194,6 @@ pub async fn add_api_key_expiry_task(
})
})
.ok_or(errors::ApiErrorResponse::InternalServerError)
.into_report()
.attach_printable("Failed to obtain initial process tracker schedule time")?;
if schedule_time <= current_time {
@ -302,7 +298,6 @@ pub async fn update_api_key(
// Process exist in process, update the process with new schedule_time
update_api_key_expiry_task(store, &api_key, expiry_reminder_days)
.await
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Failed to update API key expiry reminder task in process tracker",
@ -313,7 +308,6 @@ pub async fn update_api_key(
// Process exist in process, revoke it
revoke_api_key_expiry_task(store, &key_id)
.await
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Failed to revoke API key expiry reminder task in process tracker",
@ -327,7 +321,6 @@ pub async fn update_api_key(
// schedule_time based on new expiry set.
add_api_key_expiry_task(store, &api_key, expiry_reminder_days)
.await
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Failed to insert API key expiry reminder task to process tracker",
@ -378,7 +371,6 @@ pub async fn update_api_key_expiry_task(
};
let updated_api_key_expiry_workflow_model = serde_json::to_value(updated_tracking_data)
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
format!("unable to serialize API key expiry tracker: {updated_tracking_data:?}")
@ -432,7 +424,6 @@ pub async fn revoke_api_key(
if existing_process_tracker_task.is_some() {
revoke_api_key_expiry_task(store, key_id)
.await
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Failed to revoke API key expiry reminder task in process tracker",