From 74d2275908f2507d830bbd4ae9eb1e69aca03bea Mon Sep 17 00:00:00 2001 From: Facundo Bozzi Date: Tue, 8 Jul 2025 14:19:56 -0300 Subject: [PATCH 1/2] ENS/eth address network error being displayed on the frontend --- src/app/(mobile-ui)/withdraw/crypto/page.tsx | 8 +++++++- src/services/requests.ts | 14 +++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/app/(mobile-ui)/withdraw/crypto/page.tsx b/src/app/(mobile-ui)/withdraw/crypto/page.tsx index 8f780d4e7..41a64a03c 100644 --- a/src/app/(mobile-ui)/withdraw/crypto/page.tsx +++ b/src/app/(mobile-ui)/withdraw/crypto/page.tsx @@ -45,6 +45,7 @@ export default function WithdrawCryptoPage() { setIsPreparingReview, paymentError, setPaymentError, + setError: setWithdrawError, } = useWithdrawFlow() const { @@ -62,8 +63,13 @@ export default function WithdrawCryptoPage() { (error: string | null) => { setPaymentError(error) dispatch(paymentActions.setError(error)) + // Also set the withdraw flow error state for display in InitialWithdrawView + setWithdrawError({ + showError: !!error, + errorMessage: error || '', + }) }, - [setPaymentError, dispatch] + [setPaymentError, dispatch, setWithdrawError] ) const clearErrors = useCallback(() => { diff --git a/src/services/requests.ts b/src/services/requests.ts index 99d7c32f8..286c97919 100644 --- a/src/services/requests.ts +++ b/src/services/requests.ts @@ -18,7 +18,19 @@ export const requestsApi = { }) if (!response.ok) { - throw new Error(`Failed to create request: ${response.statusText}`) + let errorMessage = `Failed to create request: ${response.statusText}` + + try { + const errorData = await response.json() + if (errorData.error) { + errorMessage = errorData.error + } + } catch (parseError) { + // If we can't parse the response, use the default error message + console.warn('Could not parse error response:', parseError) + } + + throw new Error(errorMessage) } return response.json() From fc494a3b677eb2743db4dfbb5662948e4d07b811 Mon Sep 17 00:00:00 2001 From: Facundo Bozzi Date: Tue, 8 Jul 2025 17:05:17 -0300 Subject: [PATCH 2/2] linting --- src/services/requests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/requests.ts b/src/services/requests.ts index 286c97919..67c34cdac 100644 --- a/src/services/requests.ts +++ b/src/services/requests.ts @@ -19,7 +19,7 @@ export const requestsApi = { if (!response.ok) { let errorMessage = `Failed to create request: ${response.statusText}` - + try { const errorData = await response.json() if (errorData.error) { @@ -29,7 +29,7 @@ export const requestsApi = { // If we can't parse the response, use the default error message console.warn('Could not parse error response:', parseError) } - + throw new Error(errorMessage) }