Skip to content

[TASK-14649] fix: update error messages to direct users to contact support#1222

Merged
Hugo0 merged 2 commits intopeanut-wallet-devfrom
feat/update-error-message
Sep 17, 2025
Merged

[TASK-14649] fix: update error messages to direct users to contact support#1222
Hugo0 merged 2 commits intopeanut-wallet-devfrom
feat/update-error-message

Conversation

@Zishan-7
Copy link
Contributor

No description provided.

@Zishan-7 Zishan-7 requested a review from Hugo0 September 17, 2025 06:16
@vercel
Copy link

vercel bot commented Sep 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Ready Ready Preview Comment Sep 17, 2025 6:22am

@notion-workspace
Copy link

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 17, 2025

Walkthrough

This 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

Cohort / File(s) Summary
Mobile UI - History page
src/app/(mobile-ui)/history/page.tsx
EmptyState description updated to “Please contact support.”
Add/Withdraw flow
src/components/AddWithdraw/AddWithdrawCountriesList.tsx
Error text after addBankAccount no data: appended “or contact support.”
Action/Payment buttons
src/components/Common/ActionListDaimoPayButton.tsx
Three error paths updated to “try again or contact support.”
Home history UI
src/components/Home/HomeHistory.tsx
EmptyState description changed to “Please contact Support.”
Payment confirm view
src/components/Payment/Views/Confirm.payment.view.tsx
Missing payment details error now includes “or contact support.”
Request/Pay wrapper
src/components/PintaReqPay/PintaReqViewWrapper.tsx
ERROR state message changed to “Please contact Support.”
Signup flow
src/components/Setup/Views/Signup.tsx
Handle availability check error now includes “or contact support.”
Constants
src/constants/general.consts.ts
ROUTE_NOT_FOUND_ERROR ends with “contact support.”
Onramp hook
src/hooks/useCreateOnramp.ts
Catch block appends “or contact support.” to error message.
KYC flow hook
src/hooks/useKycFlow.ts
Missing verification links error: “Please contact support.”
SDK error handler
src/utils/sdkErrorHandler.utils.tsx
Multiple switch-case messages and default updated to “Please contact support.”

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • Hugo0
  • jjramirezn
  • kushagrasarathe

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning No pull request description was provided by the author, so there is no descriptive text relating the changeset to higher-level intent or testing/rollback instructions; an empty description does not document the scope beyond what the title and diff show. Because the description is missing rather than describing the changes, it cannot be considered meaningfully related to the changeset. Please add a short PR description (2–4 sentences) summarizing the intent, the areas affected (e.g., "updated error copy across history, payment, setup, and SDK error handler"), any user-visible behavior changes, and whether any QA steps or feature flags are needed; this helps reviewers and release notes generation.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[TASK-14649] fix: update error messages to direct users to contact support" accurately summarizes the primary change in the diff, which is updating user-facing error copy across multiple files to direct users to contact support; it is concise, relevant, and tied to the task ID used in the branch. The wording is clear and focused on the main intent (error message updates) without extraneous file lists or unrelated details.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/update-error-message

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (11)
src/constants/general.consts.ts (1)

203-205: Standardize phrasing; keep tone consistent with PR

Use “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 CTA

Other 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 action

Copy 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 flow

The 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 missing

This 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 string

The 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 copy

Catch 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3aa019f and f237f4e.

📒 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.ts
  • src/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.tsx
  • src/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.tsx
  • src/components/Common/ActionListDaimoPayButton.tsx
  • src/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.

@Hugo0 Hugo0 merged commit 5abe36d into peanut-wallet-dev Sep 17, 2025
5 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.

2 participants