Skip to content

Commit

Permalink
feat: Revamp ErrorPage for better error handling
Browse files Browse the repository at this point in the history
Redesigned the ErrorPage to provide a more informative and user-friendly experience when errors occur.

- Introduced a minimized error card that displays basic error information and allows users to expand for more details.
- Implemented an expanded error page that showcases the full stack trace and provides navigation options.
- Updated error handling in MetadataEditorPage and MediaStorePage to utilize the new ErrorPage component.
- Added preview composables for both light and dark themes to ensure visual consistency.
  • Loading branch information
BobbyESP committed Nov 21, 2024
1 parent 5f5588a commit 45d2f3e
Show file tree
Hide file tree
Showing 5 changed files with 369 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ fun MediaStorePage(
is ResourceState.Loading -> LoadingPage(text = stringResource(R.string.loading_mediastore))

is ResourceState.Error -> ErrorPage(
error = songsList.message ?: "Unknown"
modifier = Modifier.fillMaxSize(),
throwable = Exception(songsList.message ?: "Unknown")
) { onReloadMediaStore() }

is ResourceState.Success -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ fun MetadataEditorPage(
.navigationBarsPadding()
) { state ->
when (state) {
is ScreenState.Error -> ErrorPage(error = state.exception.stackTrace.toString()) {
is ScreenState.Error -> ErrorPage(
modifier = Modifier.fillMaxSize(),
throwable = state.exception
) {
onEvent(MetadataEditorVM.Event.LoadMetadata(receivedAudio.localPath))
}

Expand Down
Loading

0 comments on commit 45d2f3e

Please sign in to comment.