Skip to content

Start up error handling #369

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

Merged
merged 13 commits into from
May 21, 2025
Merged

Conversation

dkackman
Copy link
Collaborator

fix #140

If there is an error during initialization it now shows the error, logs out of the wallet and navigates to the login screen, which will allow the user to delete a corrupt wallet db and resync.

@dkackman dkackman marked this pull request as draft March 24, 2025 22:46
@dkackman dkackman marked this pull request as ready for review March 26, 2025 19:43
@dkackman dkackman added this to the 0.11.0 milestone Mar 29, 2025
@dkackman dkackman self-assigned this Apr 5, 2025
@dkackman dkackman added the enhancement New feature or request label Apr 5, 2025
@dkackman dkackman requested a review from Copilot April 29, 2025 20:26
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses startup error handling by showing error details, logging out the wallet, and navigating to the login screen when an initialization error occurs.

  • Introduces an optional onError callback in loginAndUpdateState to allow custom error handling
  • Integrates a new switchWallet command across the frontend and backend
  • Updates error handling logic and error kind definitions to support database migration recoverability

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/state.ts Updated loginAndUpdateState to accept an optional onError callback
src/pages/Login.tsx Modified login flow to use the updated loginAndUpdateState
src/hooks/useInitialization.ts Added logic to handle database migration errors by logging out and updating state
src/contexts/ErrorContext.tsx Updated styling from break-all to break-words for error messages
src/bindings.ts and related files Added and integrated switchWallet command and updated error kind definitions
Other Rust command files Added switch_wallet command support across Tauri, CLI, and RPC implementations
Comments suppressed due to low confidence (1)

src/state.ts:98

  • After invoking the onError callback, the function rethrows the error; ensure that all callers of loginAndUpdateState properly handle the rethrown error to prevent unintended disruptions.
onError(error as CustomError);

@Rigidity Rigidity merged commit 8e98909 into xch-dev:main May 21, 2025
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Startup errors with actions to proceed
2 participants