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

Bugfix: added from errors factory methods #129

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

zbyszekprasak
Copy link

@zbyszekprasak zbyszekprasak commented Dec 8, 2024

In README.md there are examples of creating ErrorOr form single error as well as list of errors using ErrorOrFactory.From<int>(errors) but in library no such method exist. Here are implementations of those methods. Additionally ErrorOr<TValue>.From(errors) method is being marked as obsolete.

Examples:

ErrorOr<int> result = ErrorOrFactory.From<int>(Error.Unexpected());
ErrorOr<int> result = ErrorOrFactory.From<int>([Error.Validation(), Error.Validation()]);
public ErrorOr<int> MultipleErrorsToErrorOr()
{
    return ErrorOrFactory.From([
        Error.Validation(description: "Invalid Name"),
        Error.Validation(description: "Invalid Last Name")
    ]);
}
// Now obsolete
ErrorOr<Person> errorOrPerson = ErrorOr<Person>.From([Error.Validation(), Error.Validation()]);

@zbyszekprasak zbyszekprasak force-pushed the bugfix/added-from-errors-factory-methods branch from 9d3e099 to 9c823b5 Compare December 15, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant