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

ExVatcheck.check - make invalid states invalid #11

Open
stefanluptak opened this issue Dec 10, 2021 · 0 comments
Open

ExVatcheck.check - make invalid states invalid #11

stefanluptak opened this issue Dec 10, 2021 · 0 comments

Comments

@stefanluptak
Copy link

Hi there. 🙂

First of all, thanks a lot for this little but very useful library.

One thing I am struggling a bit with is the return type of the ExVatcheck.check/1 function. Since it is a struct with 4 keys, the number of possible states is too big and doesn't represent the reality.

In the spirit of the "Make Illegal States Unrepresentable" I think it would be more convenient if that function returns structs that represent the only possible outcomes:

%ExVatcheck.InvalidFormatError{}
%ExVatcheck.ViesServiceError{message: String.t()}
%ExVatcheck.ViesResponseInvalid{}
%ExVatcheck.ViesResponseValid{response: map()}

Of course, those structs can be tuples or something similar. It's just a rough idea and I will be happy to implement it, if there's a positive feedback to this and once we agree on a way to do this.

What do you think?

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

No branches or pull requests

1 participant