Repository navigation
fix(sentry): pass a string title to every alert dialog - #1140
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prevents React Native Alert.alert crashes on Android by ensuring alert titles/messages are always strings when displaying caught/rejected errors (notably from native module rejections and sharing/preview flows).
Changes:
- Added
errorMessage(error: unknown): stringhelper to safely coerce thrown/rejected values into a displayable string. - Updated
ConversationActionsto always pass a string title and a string message toAlert.alerton share failures. - Updated
FileBubblePreviewto always pass a string title and a string message toAlert.alerton preview failures, and added unit tests forerrorMessage.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/utils/specs/errorUtils.spec.ts | Adds test coverage for errorMessage across common error/rejection shapes. |
| src/utils/errorUtils.ts | Introduces errorMessage helper with safe fallback to i18n.t('COMMON.ERROR'). |
| src/screens/chat-screen/conversation-actions/ConversationActions.tsx | Uses errorMessage and a string title to avoid invalid alert arguments from share failures. |
| src/screens/chat-screen/components/message-components/FileBubble.tsx | Uses errorMessage to avoid passing non-strings into Alert.alert during file preview failures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
muhsin-k
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Opening a file attachment that no installed app can handle rejects with an error object, and
FileBubblepassed that object straight intoAlert.alertas the title.Alertforwards its arguments across the bridge untouched, so Android'sDialogModuleread the title as a string, failed the cast, and killed the process. It accounts for 2.2K events across 90 users.Give both preview failures a real title and render the error as the message.
ConversationActionshad the same shape via anas Errorcast that produced an undefined title when a share rejected with anything other than an Error, so it moves to the same helper.Fixes CHATWOOT-MOBILE-C0.
Type of change