-
Notifications
You must be signed in to change notification settings - Fork 12
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
Should we returns meaningful error or should we keep it simple, stupid? #3
Comments
As discussed yesterday, I believe it would be beneficial to output the type of error encountered. By the way, I think instead of a simple case we could output several in case you have an electron Visa |
That's right! So the output would be a [
{
"issuingNetwork": "visaElectron",
"resultCode": "LengthError"
},
{
"issuingNetwork": "visa",
"resultCode": "Ok"
}
] Is it what you were thinking? |
I don't think it's useful to output all networks with their associated error codes, but besides that, yes |
Not all networks but all the matching one by IIN ranges. It could even be a nullable value when resultCode is null/undefined then there is no error (in this case we will have to rename resultCode into errorCode). |
Ok as a result seems good for me. |
I think the percent way is going to be arbitrary. I am not in favor of that. As per #2, the first one is the most plausible one. We follow the enum's order (which is a bit, well, a bit arbitrary too, but less). As a library I don't really want to take this kind of decision for the developer. They can still wrap the api with their own logic if they want to. |
It would be better to have something meaningful as a return type instead of |
This is also linked to issue #5, I believe it's better to return an object rather than an enum, but I have yet to draft a complete answer as to why for @thinkbeforecoding. I had a tough week ;) |
In response to my #48, return of empty is fine as long as the reason for empty is given along with it like (not found or invalid input). Otherwise empty return is a swallowed error for user. Reading at this, I feel a lot has already been discussed. Glad to be a part of this ^^ |
@hey24sheep Glad to have you as a contributor. This is a on going discussion and your input is more than welcome :) |
Hello,
Instead of an empty list maybe we could return a Result of data. Where Result can contains an error type (like Luhn check error or length error) or a all good with data something like
This could be nice in the front-end to show message to the end user like "This card seems to be a visa be the length does not match. A visa should have 13 or 16 numbers."
Of course we wont handle the message, but this issue will provide the tool to unlock the feature to developers
Thoughts? Would it be useful?
cc @4gq @fighou @torendil
The text was updated successfully, but these errors were encountered: