[TASK-14649] fix: update error messages to direct users to contact support#1222
[TASK-14649] fix: update error messages to direct users to contact support#1222Hugo0 merged 2 commits intopeanut-wallet-devfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR updates user-facing error message text across multiple components, hooks, constants, and utilities. Phrases like “Please try again later” or “Please try again.” are changed to include “Please contact support.” No logic, control flow, or API signatures are modified. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (11)
src/constants/general.consts.ts (1)
203-205: Standardize phrasing; keep tone consistent with PRUse “Please …” phrasing like elsewhere and drop the comma before “or” for smoother copy.
-export const ROUTE_NOT_FOUND_ERROR = - 'No route found for this token pair. You can try with a different token pair, or contact support.' +export const ROUTE_NOT_FOUND_ERROR = + 'No route found for this token pair. Please try a different token pair or contact support.'Optionally, centralize strings like “Please contact support.” into a shared constant to avoid drift across files.
src/components/Home/HomeHistory.tsx (1)
177-181: Consistency: use lowercase “support” and consider adding a Support CTAOther files use “support” (lowercase). Since EmptyState supports a CTA, offer a direct link.
- <h2 className="text-base font-bold">Recent Transactions</h2>{' '} - <EmptyState icon="alert" title="Error loading transactions!" description="Please contact Support." /> + <h2 className="text-base font-bold">Recent Transactions</h2>{' '} + <EmptyState + icon="alert" + title="Error loading transactions!" + description="Please contact support." + cta={<Link href="/support" className="mt-2 inline-block text-sm underline">Contact support</Link>} + />src/app/(mobile-ui)/history/page.tsx (1)
97-101: Optional: add a Support CTA for quicker user actionCopy is good. Consider adding a link to /support to reduce user friction.
- <h2 className="text-base font-bold">Transactions</h2>{' '} - <EmptyState icon="alert" title="Error loading transactions!" description="Please contact support." /> + <h2 className="text-base font-bold">Transactions</h2>{' '} + <EmptyState + icon="alert" + title="Error loading transactions!" + description="Please contact support." + cta={<a href="/support" className="mt-2 inline-block text-sm underline">Contact support</a>} + />Add import (top of file):
import Link from 'next/link' // if you prefer <Link> instead of <a>src/hooks/useCreateOnramp.ts (1)
75-79: Avoid rail-specific wording (“bank transfer”) in generic onramp flowThe flow can use different rails. Keep message neutral.
- setError('Failed to create bank transfer. Please try again or contact support.') + setError('Failed to create onramp. Please try again or contact support.')src/components/PintaReqPay/PintaReqViewWrapper.tsx (1)
21-24: Consistency: lowercase “support”Align with the rest of the PR’s copy.
- ERROR: { - title: 'There was an error', - description: 'Please contact Support.', - }, + ERROR: { + title: 'There was an error', + description: 'Please contact support.', + },src/hooks/useKycFlow.ts (1)
114-117: Unexpected state: capture for visibility when links are missingThis branch indicates an invariant break. Capture to Sentry for debugging.
- } else { - const errorMsg = 'Could not retrieve verification links. Please contact support.' - setError(errorMsg) - return { success: false, error: errorMsg } + } else { + const errorMsg = 'Could not retrieve verification links. Please contact support.' + // Capture unexpected state for observability + // (no PII; only control-flow signal) + // Sentry import required (see below) + Sentry.captureMessage('KYC links missing (no tosLink and no kycLink)', { level: 'warning' }) + setError(errorMsg) + return { success: false, error: errorMsg }Add import at top:
import * as Sentry from '@sentry/nextjs'src/components/Common/ActionListDaimoPayButton.tsx (1)
35-39: LGTM on copy; consider de-duplicating the generic error stringThe three occurrences are identical; extracting to a constant reduces drift and eases i18n later.
Example:
// constants/errors.ts export const GENERIC_TRY_AGAIN_OR_CONTACT_SUPPORT = 'Something went wrong. Please try again or contact support.'Then:
- dispatch(paymentActions.setError('Something went wrong. Please try again or contact support.')) + dispatch(paymentActions.setError(GENERIC_TRY_AGAIN_OR_CONTACT_SUPPORT))Note: This keeps “complete” path free of user-facing errors, matching prior guidance.
Also applies to: 72-78
src/components/Setup/Views/Signup.tsx (1)
79-81: Bring default-case message in line with the new catch-case copyCatch now says “or contact support,” but the default branch above still says only “Please try again.”
Change in default branch (near Line 67):
- setError('Failed to check handle availability. Please try again.') + setError('Failed to check handle availability. Please try again or contact support.')src/components/Payment/Views/Confirm.payment.view.tsx (1)
159-175: Avoid repeated dispatch on missing payment details.When
!chargeIdFromUrl && !chargeDetails, this effect can fire on every render and re‑dispatch the same error. Guard it so it runs once.Apply:
- import { useCallback, useContext, useEffect, useMemo, useState } from 'react' + import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react' @@ - const [isRouteExpired, setIsRouteExpired] = useState(false) + const [isRouteExpired, setIsRouteExpired] = useState(false) + const hasSetMissingChargeErrorRef = useRef(false) @@ - } else if (!chargeIdFromUrl && !chargeDetails) { - dispatch( - paymentActions.setError('Payment details are missing. Please go back and try again or contact support.') - ) + } else if (!chargeIdFromUrl && !chargeDetails && !hasSetMissingChargeErrorRef.current) { + dispatch( + paymentActions.setError('Payment details are missing. Please go back and try again or contact support.') + ) + hasSetMissingChargeErrorRef.current = true }src/utils/sdkErrorHandler.utils.tsx (2)
15-45: Reduce repetition and prep for i18n with a small helper.The same suffix is repeated across many cases. A tiny helper keeps copy consistent and eases future localization.
Apply pattern:
import peanut from '@squirrel-labs/peanut-sdk' +const withSupport = (msg: string) => `${msg} Please contact support.` + export const ErrorHandler = (error: any) => { if (error instanceof peanut.interfaces.SDKStatus && !error.originalError) { switch (error.code) { @@ - case peanut.interfaces.ECreateLinkStatusCodes.ERROR_GETTING_LINKS_FROM_TX: - return 'Something went wrong while getting the links from the transaction. Please contact support.' + case peanut.interfaces.ECreateLinkStatusCodes.ERROR_GETTING_LINKS_FROM_TX: + return withSupport('Something went wrong while getting the links from the transaction.') @@ - case peanut.interfaces.ECreateLinkStatusCodes.ERROR_SIGNING_AND_SUBMITTING_TX: - return 'Something went wrong while signing and submitting the transaction. Please contact support.' + case peanut.interfaces.ECreateLinkStatusCodes.ERROR_SIGNING_AND_SUBMITTING_TX: + return withSupport('Something went wrong while signing and submitting the transaction.') @@ - default: - return 'Something went wrong. Please contact support.' + default: + return withSupport('Something went wrong.')Would you like me to apply this across all similar cases in this file?
15-45: Optional: add telemetry for SDK error codes.To help Support, consider capturing
error.code(not user‑visible) when returning generic messages.Example:
- default: - return withSupport('Something went wrong.') + default: + captureMessage('SDKStatus default error', { level: 'warning', extra: { code: error.code } }) + return withSupport('Something went wrong.')
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
src/app/(mobile-ui)/history/page.tsx(1 hunks)src/components/AddWithdraw/AddWithdrawCountriesList.tsx(1 hunks)src/components/Common/ActionListDaimoPayButton.tsx(2 hunks)src/components/Home/HomeHistory.tsx(1 hunks)src/components/Payment/Views/Confirm.payment.view.tsx(1 hunks)src/components/PintaReqPay/PintaReqViewWrapper.tsx(1 hunks)src/components/Setup/Views/Signup.tsx(1 hunks)src/constants/general.consts.ts(1 hunks)src/hooks/useCreateOnramp.ts(1 hunks)src/hooks/useKycFlow.ts(1 hunks)src/utils/sdkErrorHandler.utils.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/components/AddWithdraw/DynamicBankAccountForm.tsx:279-279
Timestamp: 2025-08-14T08:02:26.705Z
Learning: For hotfixes in the peanut-ui codebase, prefer generic error messages over specific validation error details until the copy can be reviewed with the team, even when the validation functions return detailed error messages.
📚 Learning: 2025-06-22T16:10:53.167Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#915
File: src/hooks/useKycFlow.ts:96-124
Timestamp: 2025-06-22T16:10:53.167Z
Learning: The `initiateKyc` function in `src/app/actions/users.ts` already includes comprehensive error handling with try-catch blocks and returns structured responses with either `{ data }` or `{ error }` fields, so additional try-catch blocks around its usage are not needed.
Applied to files:
src/hooks/useCreateOnramp.tssrc/components/Setup/Views/Signup.tsx
📚 Learning: 2025-08-22T07:28:32.281Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1104
File: src/components/Payment/PaymentForm/index.tsx:522-545
Timestamp: 2025-08-22T07:28:32.281Z
Learning: In `src/components/Payment/PaymentForm/index.tsx`, the `handleCompleteDaimoPayment` function is only for updating payment status in the backend after a successful Daimo payment. Payment success/failure is handled by Daimo itself, so try/catch error handling and error display are not needed for backend sync failures - users shouldn't see errors if payment succeeded but database update failed.
Applied to files:
src/components/Payment/Views/Confirm.payment.view.tsxsrc/components/Common/ActionListDaimoPayButton.tsx
📚 Learning: 2025-08-26T15:25:53.328Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1132
File: src/app/[...recipient]/client.tsx:394-397
Timestamp: 2025-08-26T15:25:53.328Z
Learning: In `src/components/Common/ActionListDaimoPayButton.tsx`, the `handleCompleteDaimoPayment` function should not display error messages to users when DB update fails because the Daimo payment itself has succeeded - showing errors would be confusing since the payment was successful.
Applied to files:
src/components/Payment/Views/Confirm.payment.view.tsxsrc/components/Common/ActionListDaimoPayButton.tsxsrc/components/AddWithdraw/AddWithdrawCountriesList.tsx
📚 Learning: 2025-07-24T13:26:10.290Z
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#1014
File: src/components/Claim/Link/Initial.view.tsx:413-413
Timestamp: 2025-07-24T13:26:10.290Z
Learning: In the peanut-ui repository, the change from `${SQUID_API_URL}/route` to `${SQUID_API_URL}/v2/route` in src/components/Claim/Link/Initial.view.tsx was a typo fix, not an API migration, as the codebase was already using Squid API v2.
Applied to files:
src/constants/general.consts.ts
📚 Learning: 2025-08-11T10:35:02.715Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#1078
File: src/hooks/useKycFlow.ts:129-141
Timestamp: 2025-08-11T10:35:02.715Z
Learning: In the KYC flow implementation in `src/hooks/useKycFlow.ts`, when Terms of Service (ToS) is accepted, there will always be a KYC link available in the `apiResponse`. The system ensures this invariant, so defensive checks for missing KYC links after ToS acceptance are unnecessary.
Applied to files:
src/hooks/useKycFlow.ts
📚 Learning: 2024-10-08T20:13:42.967Z
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#422
File: src/components/Request/Pay/Pay.tsx:113-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `PayRequestLink` component (`src/components/Request/Pay/Pay.tsx`), when resolving ENS names, handle errors by displaying an appropriate error message to the user if the ENS cannot be resolved.
Applied to files:
src/components/Common/ActionListDaimoPayButton.tsx
📚 Learning: 2024-11-18T21:36:11.486Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#535
File: src/components/Claim/Claim.tsx:142-146
Timestamp: 2024-11-18T21:36:11.486Z
Learning: In `src/components/Claim/Claim.tsx`, external calls like token price fetching and cross-chain details retrieval are already encapsulated within existing `try...catch` blocks, so additional error handling may be unnecessary.
Applied to files:
src/utils/sdkErrorHandler.utils.tsx
📚 Learning: 2025-05-22T15:38:48.586Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".
Applied to files:
src/components/AddWithdraw/AddWithdrawCountriesList.tsx
📚 Learning: 2024-10-25T11:33:46.776Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#484
File: src/components/Cashout/Components/Initial.view.tsx:273-274
Timestamp: 2024-10-25T11:33:46.776Z
Learning: In the `InitialCashoutView` component (`src/components/Cashout/Components/Initial.view.tsx`), linked bank accounts should not generate error states, and the `ValidatedInput` component will clear any error messages if needed. Therefore, it's unnecessary to manually clear the error state when selecting or clearing linked bank accounts.
Applied to files:
src/components/AddWithdraw/AddWithdrawCountriesList.tsx
📚 Learning: 2025-08-14T14:42:54.411Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.
Applied to files:
src/components/AddWithdraw/AddWithdrawCountriesList.tsx
🧬 Code graph analysis (4)
src/components/Payment/Views/Confirm.payment.view.tsx (1)
src/redux/slices/payment-slice.ts (1)
paymentActions(81-81)
src/components/Home/HomeHistory.tsx (1)
src/components/Global/EmptyStates/EmptyState.tsx (1)
EmptyState(13-28)
src/app/(mobile-ui)/history/page.tsx (1)
src/components/Global/EmptyStates/EmptyState.tsx (1)
EmptyState(13-28)
src/components/Common/ActionListDaimoPayButton.tsx (1)
src/redux/slices/payment-slice.ts (1)
paymentActions(81-81)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Deploy-Preview
🔇 Additional comments (3)
src/components/Payment/Views/Confirm.payment.view.tsx (1)
172-174: LGTM: error copy updated to guide users to support.Change matches the PR objective without impacting control flow.
src/utils/sdkErrorHandler.utils.tsx (1)
15-45: LGTM: standardized error copy to “Please contact support.”Updates are consistent and align with the product guidance.
src/components/AddWithdraw/AddWithdrawCountriesList.tsx (1)
99-99: Standardize "contact support" phrasing and centralize copy
- Replace this inline message with a shared constant/helper (e.g. RETRY_OR_CONTACT_SUPPORT) and route it through i18n.
- Normalize casing/punctuation ("support" vs "Support") consistently across the app.
Location/snippet:
src/components/AddWithdraw/AddWithdrawCountriesList.tsx (≈ line 99) return { error: 'Failed to process bank account. Please try again or contact support.' }Automated search couldn't verify occurrences (ripgrep skipped files). Manually confirm and replace all matches across the repo.
No description provided.