-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add custom exception handlers for ViewModels #15
Add custom exception handlers for ViewModels #15
Conversation
Signed-off-by: Vitaly Peryatin <peryatin.vitalik37@gmail.com>
kviewmodel/src/commonMain/kotlin/com/adeo/kviewmodel/KViewModel.kt
Outdated
Show resolved
Hide resolved
kviewmodel/src/commonMain/kotlin/com/adeo/kviewmodel/KViewModel.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Vitaly Peryatin <peryatin.vitalik37@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a develop
branch. Please target it for this PR. When I have time, I will create a release.
Thank you!
Hello! Thanks for your suggestions. I don't think it's a good idea to add a global error handler for the entire application. If one of the developers wishes to use the global handler, then this will affect all existing ViewModels. Now errors will not fall into the default Therefore, I think that it is better not to add such a behavior change feature to existing code. I think it would be best to give the ability to customize CoroutineScope in subclasses. To do this, it would be worth doing Further, all the necessary behavior ( @Skeptick @AlexGladkov what do you think? |
Hello, @Starmel ! I saved an opportunity not to use a single CouroutineExceptionHandler for all ViewModels. Behavior of exception handling will not be changed by default relative to the current version of the library. But there is will be additionally option for applications which use 'BaseViewModels' with custom exception handlers. It is usually more safe to have base coroutine exception handler, because it will not to crash whole application if some exception will occur. I think it would be useful to promote your library because this is a fairly common case. But if developers don't want to use this feature, nothing will change in their code :) I thought about your suggestion to make |
I agree with @VitalyPeryatin. |
Okay |
Signed-off-by: Vitaly Peryatin <peryatin.vitalik37@gmail.com>
@Skeptick |
Fix this issue: #13
Add opportunities for: