-
Notifications
You must be signed in to change notification settings - Fork 28
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
[enhancement] Use enums instead of strings for known errors #53
Comments
@OlegNovosad I also thought about it but one issue would be we would have to update the library every time new field is added for enum. What do you think? |
We can try sealed class Error {
final String rawValue;
Error(this.rawValue);
}
class Unsupported extends Error {
Unsupported() : super("UNSUPPORTED");
}
class Unknown extends Error {
Unknown(super.rawValue);
} or |
Let's say new error is added by Telegram. Until we introduce the new enum/sealed type, users would check
Then after we do the update, they would have to change it again accordingly. I would assume this could be done via extensions by users if needed |
There are plenty of known errors (e.g.
UNSUPPORTED
for sensors specific events) and using enum would be less error prone for the package users.The text was updated successfully, but these errors were encountered: