-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add Map Extension Method to Support Mapping from Result<T> to Result #213
Conversation
case ResultStatus.Conflict: return result.Errors.Any() | ||
? Result.Conflict(result.Errors.ToArray()) | ||
: Result.Conflict(); | ||
case ResultStatus.CriticalError: return Result.CriticalError(result.Errors.ToArray()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need the correlation id as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CriticalError accepts a string[], so we cannot pass in the correlation id. See https://github.com/ardalis/Result/blob/main/src/Ardalis.Result/Result.cs#L223.
While Error accepts an ErrorList object that contains correlation id. See https://github.com/ardalis/Result/blob/main/src/Ardalis.Result/Result.cs#L123-L127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we're in a bit of a transition phase to using the ErrorList
class in more places but ideally we'd use the constructors that accept a CorrelationId
wherever possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have verified the CorrelationId property is propagated through the constructors where it is available. We can open another issue to add CorrelationId to the remaining constructors and then update these helper methods as needed.
See #212