Skip to content

FOUNDATIONS: Extension To Extract Error/Validation Summary #44

@cjdutoit

Description

@cjdutoit

The Ask

Create an extension method that will extract an error/validation summary from a given exception and its inner exception.

The Reason

When we do logging, the data dictionary is ignored in the error detail. Currently we would see something like this when we look at Application Insights logs:
Student validation error occurred, fix the errors and try again.

With this extension, we can extract a validation summary that can be appended to the logs and could look like this:
Student validation error occurred, fix the errors and try again. InvalidStudentException Errors: UpdatedDate => Date is the same as Created Date, Date is not recent;

#How Will This Be Used

In the logging broker we can append the validation summary by changing th

public void LogError(Exception exception) =>
    this.logger.LogError(exception, $"{exception.Message} {exception.GetValidationSummary()}");

public void LogCritical(Exception exception) =>
    this.logger.LogCritical(exception, $"{exception.Message} {exception.GetValidationSummary()}");

Metadata

Metadata

Assignees

Labels

FOUNDATIONSThe foundations category

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions