-
Notifications
You must be signed in to change notification settings - Fork 95
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
Potential misuse #102
Comments
Thanks Hossain, that's a good point, but as you said, there isn't much we can do about this. I don't want to give up on ErrorOr being a struct since it doesn't allocate memory |
you can throw an error if the default constructor is called like the following, this will at least inform the consumer about the misuse. public ErrorOr()
{
throw new InvalidOperationException("Invoking Parameterless constructor is not allowed.");
} |
added as part of #105 |
will be available as part of ErrorOr 3.x |
Note: This went out with 2.1.0 not 3.x. with #106 |
The current API allows the following which is not the intended use.
It must be like this. However the API does not enforces it because
struct
must have a default constructor.The text was updated successfully, but these errors were encountered: