From 8c7855bb62dee0f628505efae7b8378562f22592 Mon Sep 17 00:00:00 2001 From: Per Kops Date: Sat, 18 May 2024 10:40:55 +0200 Subject: [PATCH] fix: use nameof in ServiceCollectionExtensions to resolve type-name for exception message --- src/Atc.Azure.IoT/Extensions/ServiceCollectionExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Atc.Azure.IoT/Extensions/ServiceCollectionExtensions.cs b/src/Atc.Azure.IoT/Extensions/ServiceCollectionExtensions.cs index 19b3f42..f8d788a 100644 --- a/src/Atc.Azure.IoT/Extensions/ServiceCollectionExtensions.cs +++ b/src/Atc.Azure.IoT/Extensions/ServiceCollectionExtensions.cs @@ -20,7 +20,7 @@ public static IServiceCollection ConfigureIotHubServices( if (iotHubOptions is null || string.IsNullOrEmpty(iotHubOptions.ConnectionString)) { - throw new InvalidOperationException("Required service 'IotHubOptions' is not registered"); + throw new InvalidOperationException($"Required service '{nameof(IotHubOptions)}' is not registered"); } services.TryAddSingleton(); @@ -53,7 +53,7 @@ public static IServiceCollection ConfigureDeviceProvisioningServices( if (deviceProvisioningServiceOptions is null || string.IsNullOrEmpty(deviceProvisioningServiceOptions.ConnectionString)) { - throw new InvalidOperationException("Required service 'DeviceProvisioningServiceOptions' is not registered"); + throw new InvalidOperationException($"Required service '{nameof(DeviceProvisioningServiceOptions)}' is not registered"); } services.AddSingleton(s => new DeviceProvisioningService(