Skip to content

Commit

Permalink
Twelve: Log request errors throwable
Browse files Browse the repository at this point in the history
Change-Id: I93ef77cc2c277d1c01002b609e77e532a3252a10
  • Loading branch information
luca020400 committed Jan 9, 2025
1 parent aa56dde commit 954cc5b
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ActivityFragment : Fragment(R.layout.fragment_activity) {
}

is RequestStatus.Error -> {
Log.e(LOG_TAG, "Failed to load activity, error: ${it.error}")
Log.e(LOG_TAG, "Failed to load activity, error: ${it.error}", it.throwable)

recyclerView.isVisible = false
noElementsLinearLayout.isVisible = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class AddOrRemoveFromPlaylistsFragment : Fragment(R.layout.fragment_add_or_remov
}

is RequestStatus.Error -> {
Log.e(LOG_TAG, "Failed to load data, error: ${it.error}")
Log.e(LOG_TAG, "Failed to load data, error: ${it.error}", it.throwable)

adapter.submitList(emptyList())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ class AlbumsFragment : Fragment(R.layout.fragment_albums) {
}

is RequestStatus.Error -> {
Log.e(LOG_TAG, "Failed to load albums, error: ${it.error}")
Log.e(
LOG_TAG,
"Failed to load albums, error: ${it.error}",
it.throwable
)

adapter.submitList(emptyList())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ class ArtistsFragment : Fragment(R.layout.fragment_artists) {
}

is RequestStatus.Error -> {
Log.e(LOG_TAG, "Failed to load artists, error: ${it.error}")
Log.e(
LOG_TAG,
"Failed to load artists, error: ${it.error}",
it.throwable
)

adapter.submitList(emptyList())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class GenresFragment : Fragment(R.layout.fragment_genres) {
}

is RequestStatus.Error -> {
Log.e(LOG_TAG, "Failed to load genres, error: ${it.error}")
Log.e(LOG_TAG, "Failed to load genres, error: ${it.error}", it.throwable)

adapter.submitList(emptyList())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ class MainFragment : Fragment(R.layout.fragment_main) {
is RequestStatus.Error -> {
Log.e(
LOG_TAG,
"Failed to load search results, error: ${it.error}"
"Failed to load search results, error: ${it.error}",
it.throwable
)

searchAdapter.submitList(listOf())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ class MediaItemBottomSheetDialogFragment : BottomSheetDialogFragment(
}

is RequestStatus.Error -> {
Log.e(LOG_TAG, "Failed to load media item, error: ${it.error}")
Log.e(
LOG_TAG,
"Failed to load media item, error: ${it.error}",
it.throwable
)

if (it.error == MediaError.NOT_FOUND) {
// Get out of here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ class PlaylistsFragment : Fragment(R.layout.fragment_playlists) {
}

is RequestStatus.Error -> {
Log.e(LOG_TAG, "Failed to load playlists, error: ${it.error}")
Log.e(
LOG_TAG,
"Failed to load playlists, error: ${it.error}",
it.throwable
)

adapter.submitList(emptyList())

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/lineageos/twelve/utils/Api.kt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ suspend fun <T, O> MethodResult<T>.toRequestStatus(
}
)

is MethodResult.DeserializationError -> RequestStatus.Error(MediaError.DESERIALIZATION)
is MethodResult.DeserializationError -> RequestStatus.Error(MediaError.DESERIALIZATION, error)

is MethodResult.GenericError -> RequestStatus.Error(MediaError.IO)
}
Expand Down

0 comments on commit 954cc5b

Please sign in to comment.