diff --git a/services/identity/src/device_list.rs b/services/identity/src/device_list.rs --- a/services/identity/src/device_list.rs +++ b/services/identity/src/device_list.rs @@ -95,19 +95,19 @@ impl TryFrom for SignedDeviceList { type Error = tonic::Status; fn try_from(request: UpdateDeviceListRequest) -> Result { - request.new_device_list.parse().map_err(|err| { - warn!("Failed to deserialize device list update: {}", err); - tonic::Status::invalid_argument( - tonic_status_messages::INVALID_DEVICE_LIST_PAYLOAD, - ) - }) + request.new_device_list.parse() } } impl FromStr for SignedDeviceList { - type Err = serde_json::Error; + type Err = tonic::Status; fn from_str(s: &str) -> Result { - serde_json::from_str(s) + serde_json::from_str(s).map_err(|err| { + warn!("Failed to deserialize device list: {}", err); + tonic::Status::invalid_argument( + tonic_status_messages::INVALID_DEVICE_LIST_PAYLOAD, + ) + }) } } diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs --- a/services/identity/src/grpc_services/authenticated.rs +++ b/services/identity/src/grpc_services/authenticated.rs @@ -464,12 +464,7 @@ // Get and verify singleton device list let parsed_device_list: SignedDeviceList = - message.signed_device_list.parse().map_err(|err| { - warn!("Failed to deserialize device list: {}", err); - tonic::Status::invalid_argument( - tonic_status_messages::INVALID_DEVICE_LIST_PAYLOAD, - ) - })?; + message.signed_device_list.parse()?; let update_payload = DeviceListUpdate::try_from(parsed_device_list)?; crate::device_list::verify_singleton_device_list(