Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLVS-1455 Make Id of type URL #5698

Merged
merged 12 commits into from
Sep 25, 2024
6 changes: 5 additions & 1 deletion src/ConnectedMode/SlCoreConnectionAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ public Task<AdapterResponseWithData<List<OrganizationDisplay>>> GetOrganizations

try
{
var credentials = MapCredentials(credentialsModel?.ToICredentials());
if (credentialsModel == null)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this explicit check. If it is null, there will be a null reference exception that will be caught by the catch block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case the credentialsModel is null the ToICredentials will throw a generic null exception. In this case I believe it's better to be proactive and add back the .? so the exception we get becomes specific to the lack of credentials.

{
throw new ArgumentException($"Unexpected {nameof(ICredentialsModel)} argument");
}
var credentials = MapCredentials(credentialsModel.ToICredentials());
var response = await connectionConfigurationSlCoreService.ListUserOrganizationsAsync(new ListUserOrganizationsParams(credentials));
var organizationDisplays = response.userOrganizations.Select(o => new OrganizationDisplay(o.key, o.name)).ToList();

Expand Down