MetaMask / MetaMask/metamask-mobile

Update `handleVaultCorruption` function to provide information each error

Open
#18,536 1 comment 0 reactions 0 assignees View on GitHub
team-mobile-platform
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

### What is this about?

There have been a number of user reports dealing with biometric issues on login. [This](https://github.com/MetaMask/metamask-mobile/blob/2449580ad9ac94b2c27c6e16d6d5e0f5c1b1f209/app/components/Views/Login/index.tsx#L245) throws a number of errors that makes it hard to track down the root issue.

- There is a broad try…catch block in handleVaultCorruption that catches all errors and logs them without re-throwing, so it can never throw an error. But we seem to expect it to throw in the spot where it’s called.
- For a case we can’t handle properly, throw it and let it get caught in the thrown to error bound screen
- Confirm if the Invalid Password error displays correctly
- Check iOS 18 devices to make sure the error strings are the same

Each of these errors should be logged explicitly and stop.

### Scenario

_No response_

### Design

_No response_

### Technical Details

- Refactor logger function
- Any errors unhandled should throw to Error Boundary screen

### Threat Modeling Framework

_No response_

### Acceptance Criteria

- Confirm log data shows information for each error
- App should not crash but show error boundary on unknown issue

### Stakeholder review needed before the work gets merged

- [x] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at handleVaultCorruption and its caller in app/components/Views/Login/index.tsx around line 245. Review how the broad try/catch logs errors, then verify the Invalid Password behavior and error strings on iOS 18 devices. Done means each error is logged with useful information and unknown issues reach the Error Boundary without crashing the app.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, typescript
Domain
authentication, mobile
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.