Fix error messages

This commit is contained in:
Isha 2024-11-08 15:42:10 +05:30 committed by IshaVenikar
parent 88f2cc1117
commit 4d2612ed03

View File

@ -185,7 +185,7 @@ const Configure = () => {
let amount: string; let amount: string;
let senderAddress: string; let senderAddress: string;
let txHash; let txHash: string | null = null;
if (createFormData.option === 'LRN' && !deployer?.minimumPayment) { if (createFormData.option === 'LRN' && !deployer?.minimumPayment) {
toast({ toast({
id: 'no-payment-required', id: 'no-payment-required',
@ -217,14 +217,13 @@ const Configure = () => {
); );
if (!txHash) { if (!txHash) {
console.error('Tx not successful');
toast({ toast({
id: 'unsuccessful-tx', id: 'unsuccessful-tx',
title: 'Transaction rejected', title: 'Transaction rejected',
variant: 'error', variant: 'error',
onDismiss: dismiss, onDismiss: dismiss,
}); });
return; throw new Error('Transaction rejected');
} }
// Validate transaction hash // Validate transaction hash
@ -248,6 +247,7 @@ const Configure = () => {
variant: 'error', variant: 'error',
onDismiss: dismiss, onDismiss: dismiss,
}); });
throw new Error('Transaction validation failed');
} }
} }
@ -290,7 +290,6 @@ const Configure = () => {
); );
} }
} catch (error) { } catch (error) {
console.error(error);
toast({ toast({
id: 'error-deploying-app', id: 'error-deploying-app',
title: 'Error deploying app', title: 'Error deploying app',
@ -378,7 +377,7 @@ const Configure = () => {
return txHash; return txHash;
} catch (error) { } catch (error) {
console.error('Error in transaction:', error); console.error('Error in transaction:', error);
throw new Error('Error in transaction:'); throw new Error('Error in transaction');
} finally { } finally {
setIsPaymentLoading(false); setIsPaymentLoading(false);
} }