From 4d2612ed03a72c9fcdbff2be4411574772db975a Mon Sep 17 00:00:00 2001 From: Isha Date: Fri, 8 Nov 2024 15:42:10 +0530 Subject: [PATCH] Fix error messages --- .../src/components/projects/create/Configure.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/frontend/src/components/projects/create/Configure.tsx b/packages/frontend/src/components/projects/create/Configure.tsx index dbc2d7b5..8a79020a 100644 --- a/packages/frontend/src/components/projects/create/Configure.tsx +++ b/packages/frontend/src/components/projects/create/Configure.tsx @@ -185,7 +185,7 @@ const Configure = () => { let amount: string; let senderAddress: string; - let txHash; + let txHash: string | null = null; if (createFormData.option === 'LRN' && !deployer?.minimumPayment) { toast({ id: 'no-payment-required', @@ -217,14 +217,13 @@ const Configure = () => { ); if (!txHash) { - console.error('Tx not successful'); toast({ id: 'unsuccessful-tx', title: 'Transaction rejected', variant: 'error', onDismiss: dismiss, }); - return; + throw new Error('Transaction rejected'); } // Validate transaction hash @@ -248,6 +247,7 @@ const Configure = () => { variant: 'error', onDismiss: dismiss, }); + throw new Error('Transaction validation failed'); } } @@ -290,7 +290,6 @@ const Configure = () => { ); } } catch (error) { - console.error(error); toast({ id: 'error-deploying-app', title: 'Error deploying app', @@ -378,7 +377,7 @@ const Configure = () => { return txHash; } catch (error) { console.error('Error in transaction:', error); - throw new Error('Error in transaction:'); + throw new Error('Error in transaction'); } finally { setIsPaymentLoading(false); }