don't set errorMessage as substring except for >max crypto amt errors

This commit is contained in:
sneurlax 2023-01-27 15:32:23 -06:00
parent ec64c77c45
commit 26dfaa065a

View file

@ -500,10 +500,10 @@ class _BuyFormState extends ConsumerState<BuyForm> {
} else {
// Error; probably amount out of bounds
String errorMessage = "${quoteResponse.exception?.errorMessage}";
errorMessage = errorMessage.substring(
(errorMessage.indexOf('getQuote exception: ') ?? 19) + 20,
errorMessage.indexOf(", value: null"));
if (errorMessage.contains('must be between')) {
errorMessage = errorMessage.substring(
(errorMessage.indexOf('getQuote exception: ') ?? 19) + 20,
errorMessage.indexOf(", value: null"));
_BuyFormState.boundedCryptoTicker = errorMessage.substring(
errorMessage.indexOf('The ') + 4,
errorMessage.indexOf(' amount must be between'));