Skip to content

Commit

Permalink
fix: use nameof in ServiceCollectionExtensions to resolve type-name f…
Browse files Browse the repository at this point in the history
…or exception message
  • Loading branch information
perkops committed May 18, 2024
1 parent a9ff145 commit 8c7855b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Atc.Azure.IoT/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IDeviceTwinModuleExtractor, DeviceTwinModuleExtractor>();
Expand Down Expand Up @@ -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<IDeviceProvisioningService, DeviceProvisioningService>(s => new DeviceProvisioningService(
Expand Down

0 comments on commit 8c7855b

Please sign in to comment.