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

Update ErrorOr.cs | removal of the second null check for errors | pri… #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kebrok
Copy link

@kebrok kebrok commented Nov 20, 2024

…vate ErrorOr(List errors)

private ErrorOr(List errors)
{
if (errors is null)
{
throw new ArgumentNullException(nameof(errors));
}

if (errors is null || errors.Count == 0)
{
	throw new ArgumentException("Cannot create an ErrorOr<TValue> from an empty collection of errors. Provide at least one error.", nameof(errors));
}

_errors = errors;

}

This check is unnecessary due to the one performed just above.

…vate ErrorOr(List<Error> errors)

private ErrorOr(List<Error> errors)
{
	if (errors is null)
	{
		throw new ArgumentNullException(nameof(errors));
	}

	if (errors is null || errors.Count == 0)
	{
		throw new ArgumentException("Cannot create an ErrorOr<TValue> from an empty collection of errors. Provide at least one error.", nameof(errors));
	}

	_errors = errors;
}

This check is unnecessary due to the one performed just above.
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