Skip to content

Commit

Permalink
fix(environment): adjust getEnvironment exception handling (#89)
Browse files Browse the repository at this point in the history
Refs: #84
Reviewed-By: Evelyn Gurschler <[email protected]>
  • Loading branch information
Phil91 authored Sep 12, 2024
1 parent d44ef09 commit 8b526a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/clients/Dim.Clients/Api/Cf/CfClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ private static async Task<Guid> GetEnvironmentId(string tenantName, Cancellation
.ConfigureAwait(false);

var tenantEnvironment = environments?.Resources.Where(x => x.Name == tenantName);
if (tenantEnvironment == null || tenantEnvironment.Count() > 1)
if (tenantEnvironment == null || tenantEnvironment.Count() != 1)
{
throw new ConflictException($"There should only be one cf environment for tenant {tenantName}");
throw new ServiceException($"There should only be one cf environment for tenant {tenantName}", true);
}

return tenantEnvironment.Single().EnvironmentId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public async Task AssignEntitlements(BasicAuthSettings basicAuthSettings, Guid s
);

await client.PutAsJsonAsync("/entitlements/v1/subaccountServicePlans", data, JsonSerializerExtensions.Options, cancellationToken)
.CatchingIntoServiceExceptionFor("assign-entitlements", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE).ConfigureAwait(false);
.CatchingIntoServiceExceptionFor("assign-entitlements", HttpAsyncResponseMessageExtension.RecoverOptions.ALLWAYS).ConfigureAwait(false);
}
}

0 comments on commit 8b526a5

Please sign in to comment.