Add High network fees error message
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.",
|
||||
|
||||
InsufficientFundsType.HighNetworkFee =>
|
||||
"❌ High Network Fee\n" +
|
||||
"The gas fee for this position is too high.\n" +
|
||||
"Position opening rejected.",
|
||||
|
||||
_ => "❌ **Transaction Failed**\n" +
|
||||
_ => "❌ 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
|
||||
}
|
||||
Reference in New Issue
Block a user