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

Search Parameter validation failure issues logged #3341

Merged
merged 3 commits into from
Jun 8, 2023

Conversation

rajithaalurims
Copy link
Contributor

Description

This PR is about logging the actual reason that caused Search Parameter validation failure and logs InvalidDefinitionException in Exception Telemetry for different accounts in search parameter definition builder.

Current code captures details about what is causing validation failure but not logging it. I modified code to log the cause that fails validation.

Related issues

Addresses [issue # 88668].

Testing

Do not have invalid search parameters in my local or Test.
So tested it by breaking the code intentionally to confirm detailed logs are showing up.

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@rajithaalurims rajithaalurims added Bug Bug bug bug. Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs labels Jun 8, 2023
@rajithaalurims rajithaalurims added this to the S116 milestone Jun 8, 2023
@rajithaalurims rajithaalurims requested a review from a team as a code owner June 8, 2023 16:49
{
issueDetails.Append(issue.Diagnostics);
issueDetails.AppendLine();
}
}
catch (InvalidDefinitionException ex)
Copy link
Contributor

@fhibf fhibf Jun 8, 2023

Choose a reason for hiding this comment

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

Maybe we can simplify this part of the code with:

catch (FhirException ex)
{
    StringBuilder issueDetails = new StringBuilder();
    foreach (OperationOutcomeIssue issue in ex.Issues)
    {
        issueDetails.Append(issue.Diagnostics).Append("; ");
    }
    
    _logger.LogWarning(ex, "Error loading search parameter {Url} from data store. Issues: {Issues}", searchParam.GetStringScalar("url"), issueDetails.ToString());
}

Copy link
Contributor

Choose a reason for hiding this comment

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

As InvalidDefinitionException and SearchParameterNotSupportedException inherit from FhirException, a single catch block can simplify the code.

@rajithaalurims rajithaalurims merged commit 25b6caf into main Jun 8, 2023
@rajithaalurims rajithaalurims deleted the personal/rajitha/sp-validation-issues branch June 8, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Bug Bug bug bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants