Skip to content

Commit 910fb1c

Browse files
authored
Improve/verbosify error messages in various ToInteropOptions methods (#481)
1 parent 4205a59 commit 910fb1c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Temporalio/Bridge/OptionsExtensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static unsafe Interop.OpenTelemetryOptions ToInteropOptions(
7171
{
7272
if (options.Url == null)
7373
{
74-
throw new ArgumentException("OpenTelemetry URL is required");
74+
throw new ArgumentException($"OpenTelemetry URL is required when {nameof(Temporalio.Runtime.OpenTelemetryOptions)} is configured");
7575
}
7676
Interop.OpenTelemetryMetricTemporality temporality;
7777
switch (options.MetricTemporality)
@@ -125,7 +125,7 @@ public static unsafe Interop.PrometheusOptions ToInteropOptions(
125125
{
126126
if (string.IsNullOrEmpty(options.BindAddress))
127127
{
128-
throw new ArgumentException("Prometheus options must have bind address");
128+
throw new ArgumentException($"BindAddress is required when {nameof(Temporalio.Runtime.PrometheusOptions)} is configured");
129129
}
130130
return new Interop.PrometheusOptions()
131131
{
@@ -150,7 +150,7 @@ public static unsafe Interop.LoggingOptions ToInteropOptions(
150150
{
151151
if (string.IsNullOrEmpty(options.Filter.FilterString))
152152
{
153-
throw new ArgumentException("Logging filter string is required");
153+
throw new ArgumentException($"FilterString is required when {nameof(Temporalio.Runtime.TelemetryFilterOptions)} is configured");
154154
}
155155
return new Interop.LoggingOptions()
156156
{
@@ -283,7 +283,7 @@ public static Interop.ClientTlsOptions ToInteropOptions(
283283
if (hasClientCert != hasClientKey)
284284
{
285285
throw new ArgumentException(
286-
"Client cert and private key must both be present or neither");
286+
$"Client cert and private key must both be present or neither when {nameof(Temporalio.Client.TlsOptions)} is configured");
287287
}
288288
return new Interop.ClientTlsOptions()
289289
{
@@ -341,7 +341,7 @@ public static Interop.ClientHttpConnectProxyOptions ToInteropOptions(
341341
{
342342
if (string.IsNullOrEmpty(options.TargetHost))
343343
{
344-
throw new ArgumentException("TargetHost is required");
344+
throw new ArgumentException($"{nameof(options.TargetHost)} is required when {nameof(Temporalio.Client.HttpConnectProxyOptions)} is configured");
345345
}
346346

347347
return new ClientHttpConnectProxyOptions
@@ -448,7 +448,7 @@ public static Interop.WorkerOptions ToInteropOptions(
448448
{
449449
if (options.TaskQueue == null)
450450
{
451-
throw new ArgumentException("Task queue must be provided in worker options");
451+
throw new ArgumentException($"Task queue must be provided when {nameof(Temporalio.Worker.TemporalWorkerOptions)} is configured");
452452
}
453453
#pragma warning disable 0618
454454
var buildId = options.DeploymentOptions?.Version?.BuildId ?? options.BuildId;

0 commit comments

Comments
 (0)