Add High network fees error message

This commit is contained in:
2025-10-10 22:40:44 +07:00
parent bdb254809e
commit e4fa4c6595
2 changed files with 13 additions and 7 deletions

View File

@@ -53,8 +53,8 @@ namespace Managing.Application.Trading.Handlers
if (currentGasFees > Constants.GMX.Config.MaximumGasFeeUsd)
{
throw new InsufficientFundsException(
$"Gas fee too high for position opening: {currentGasFees:F2} USD (threshold: {Constants.GMX.Config.MaximumGasFeeUsd} USD). Position opening cancelled.",
InsufficientFundsType.InsufficientEth);
$"Gas fee too high for position opening: {currentGasFees:F2} USD (threshold: {Constants.GMX.Config.MaximumGasFeeUsd} USD). Position opening rejected.",
InsufficientFundsType.HighNetworkFee);
}
}
}

View File

@@ -105,21 +105,26 @@ public class InsufficientFundsException : Exception
return errorType switch
{
InsufficientFundsType.InsufficientEth =>
"❌ **Insufficient ETH for Gas Fees**\n" +
"❌ Insufficient ETH for Gas Fees\n" +
"Your wallet doesn't have enough ETH to pay for transaction gas fees.\n" +
"Please add ETH to your wallet and try again.",
InsufficientFundsType.InsufficientAllowance =>
"❌ **Insufficient Token Allowance**\n" +
"❌ Insufficient Token Allowance\n" +
"The trading contract doesn't have permission to spend your tokens.\n" +
"Please approve token spending in your wallet and try again.",
InsufficientFundsType.InsufficientBalance =>
"❌ **Insufficient Token Balance**\n" +
"❌ Insufficient Token Balance\n" +
"Your wallet doesn't have enough tokens for this trade.\n" +
"Please add more tokens to your wallet and try again.",
_ => "❌ **Transaction Failed**\n" +
InsufficientFundsType.HighNetworkFee =>
"❌ High Network Fee\n" +
"The gas fee for this position is too high.\n" +
"Position opening rejected.",
_ => "❌ Transaction Failed\n" +
"The transaction failed due to insufficient funds.\n" +
"Please check your wallet balance and try again."
};
@@ -149,5 +154,6 @@ public enum InsufficientFundsType
/// <summary>
/// General insufficient funds error
/// </summary>
General
General,
HighNetworkFee
}