From ebf8bc0b85df9108049bc418f28331afb6a0f240 Mon Sep 17 00:00:00 2001 From: Todd Martin <106564991+trmartin4@users.noreply.github.com> Date: Fri, 6 Sep 2024 18:06:39 -0400 Subject: [PATCH] [PM-11749] Add device type to device trust loss logging (#4742) * Add device type to trust loss logging. * Added check for null. --- src/Api/Controllers/DevicesController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Api/Controllers/DevicesController.cs b/src/Api/Controllers/DevicesController.cs index 389d2c965..523a4864d 100644 --- a/src/Api/Controllers/DevicesController.cs +++ b/src/Api/Controllers/DevicesController.cs @@ -252,8 +252,14 @@ public class DevicesController : Controller throw new BadRequestException("Please provide a device identifier"); } - _logger.LogError("User {id} has a device key, but didn't receive decryption keys for device {device}", userId, - deviceId); + var deviceType = _currentContext.DeviceType; + if (deviceType == null) + { + throw new BadRequestException("Please provide a device type"); + } + + _logger.LogError("User {id} has a device key, but didn't receive decryption keys for device {device} of type {deviceType}", userId, + deviceId, deviceType); } }