Page MenuHomePhabricator

D13567.id44853.diff
No OneTemporary

D13567.id44853.diff

diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs
--- a/services/identity/src/client_service.rs
+++ b/services/identity/src/client_service.rs
@@ -2,7 +2,6 @@
use std::str::FromStr;
// External crate imports
-use comm_lib::aws::DynamoDBError;
use comm_lib::shared::reserved_users::RESERVED_USERNAME_SET;
use comm_opaque2::grpc::protocol_error_to_grpc_status;
use grpc_clients::identity::PlatformMetadata;
@@ -1243,32 +1242,29 @@
#[tracing::instrument(skip_all)]
pub fn handle_db_error(db_error: DBError) -> tonic::Status {
+ use comm_lib::aws::DynamoDBError as DDBError;
+ use tonic::Status;
+ use tonic_status_messages as msg;
+ use DBError as E;
+
match db_error {
- DBError::AwsSdk(DynamoDBError::InternalServerError(_))
- | DBError::AwsSdk(DynamoDBError::ProvisionedThroughputExceededException(
- _,
- ))
- | DBError::AwsSdk(DynamoDBError::RequestLimitExceeded(_)) => {
- tonic::Status::unavailable(tonic_status_messages::RETRY)
+ E::AwsSdk(DDBError::InternalServerError(_))
+ | E::AwsSdk(DDBError::ProvisionedThroughputExceededException(_))
+ | E::AwsSdk(DDBError::RequestLimitExceeded(_)) => {
+ Status::unavailable(msg::RETRY)
}
- DBError::DeviceList(DeviceListError::InvalidDeviceListUpdate) => {
- tonic::Status::invalid_argument(
- tonic_status_messages::INVALID_DEVICE_LIST_UPDATE,
- )
+ E::DeviceList(DeviceListError::InvalidDeviceListUpdate) => {
+ Status::invalid_argument(msg::INVALID_DEVICE_LIST_UPDATE)
}
- DBError::DeviceList(DeviceListError::InvalidSignature) => {
- tonic::Status::invalid_argument(
- tonic_status_messages::INVALID_DEVICE_LIST_SIGNATURE,
- )
+ E::DeviceList(DeviceListError::InvalidSignature) => {
+ Status::invalid_argument(msg::INVALID_DEVICE_LIST_SIGNATURE)
}
e => {
error!(
errorType = error_types::GENERIC_DB_LOG,
"Encountered an unexpected error: {}", e
);
- tonic::Status::failed_precondition(
- tonic_status_messages::UNEXPECTED_ERROR,
- )
+ Status::failed_precondition(msg::UNEXPECTED_ERROR)
}
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 1:19 AM (21 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2536310
Default Alt Text
D13567.id44853.diff (2 KB)

Event Timeline