-
Notifications
You must be signed in to change notification settings - Fork 7
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
Exceptions and Typed errors #67
Comments
@nvkleban Thanks for an interesting question! This is quite complicated topic. In my opinion, as we're dealing with coroutines, However, as you noted, this is quite confusing. This peculiarity stems from core architectural choice of designing Perhaps, the best compromise is to introduce a separate sealed hierarchy of failures specifically for coroutines, like I suggested above, though it'll be a major API change. What do you think? |
Now that I think about the last suggestion I made, I'm sure that it also won't work out. So, we can't omit a type |
There is couple of my thoughts on the subject. Take it with the grain of salt.
There is an excellent read for Roman Elizarov about exceptions in Kotlin
P.S. It's totally not a blocker as I use the library like you mentioned in a doc, wrapping it in a try\catch, just a genuine question that appeared in my head while I was using it. |
@nvkleban
|
Hi! Thank you for the library, it's really helpful.
While investigating it I found that it's requires wrapping
packageInstaller.createSession(apkUri).await()
in try\catch block.Have you considered instead of throwing exceptions to pass typed errors instead as you already do, but for all other cases too? It helps with understanding what could happen and react to it before it happens.
For me as user of library I can't really distinguish between InstallFailure.Exceptional and Exception been thrown.
One example would be - I encountered FileNotExists exception (when apk file was missing), while I expected some sort of InstallFailure
The text was updated successfully, but these errors were encountered: