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

fix: app crashes when delete a track if the entry is already removed … #1380

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,11 @@ private data class TrackerRemoveScreen(

fun deleteMangaFromService() {
screenModelScope.launchNonCancellable {
(tracker as DeletableTracker).delete(track)
try {
(tracker as DeletableTracker).delete(track)
} catch (e: Exception) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this'll also fail on network errors

Copy link
Contributor Author

@cuong-tran cuong-tran Oct 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, since the action is mainly removing track so just trying to catch any error on the side task of also removing entry from service.
Otherwise might need to implement:

  • Check for network, if no network, no internet, failed to connect then won't allow user to remove track.
  • If can connect to server then verify if the manga is exist then remove it from service, handle the return code to see if anything is wrong, maybe server got internal error which won't allow removing entry right now. With that we prevent user from remove the track.

And must implement that for all trackers. I would choose to prevent the app from crash first.

logcat(LogPriority.ERROR, e) { "Failed to delete entry from service" }
}
}
}

Expand Down