forked from LaconicNetwork/icns-frontend
Add error message about insufficient gas, account not exist, verification threshold
This commit is contained in:
parent
d57716dc39
commit
aee6a02b44
@ -7,3 +7,15 @@ export const KEPLR_VERSION_ERROR = "You should update keplr";
|
||||
export const KEPLR_NO_ACCOUNT_ERROR = "key doesn't exist";
|
||||
export const KEPLR_NO_ACCOUNT_MESSAGE =
|
||||
"Create a wallet account to get started with ICNS!";
|
||||
|
||||
export const INSUFFICIENT_GAS_ERROR = "insufficient funds: invalid request";
|
||||
export const INSUFFICIENT_GAS_MESSAGE =
|
||||
"Not enough OSMO in your account. Please add more OSMO to your account";
|
||||
|
||||
export const ACCOUNT_NOT_EXIST_ERROR = "does not exist: unknown address";
|
||||
export const ACCOUNT_NOT_EXIST_MESSAGE =
|
||||
"Account has not been registered on chain. Please add some OSMO to your account and try again.";
|
||||
|
||||
export const VERIFICATION_THRESHOLD_ERROR = "verfication is below threshold:";
|
||||
export const VERIFICATION_THRESHOLD_MESSAGE =
|
||||
"Verifier consensus failed. Verifiers may be offline. Please try again later.";
|
||||
|
@ -52,8 +52,14 @@ import {
|
||||
verifyTwitterAccount,
|
||||
} from "../../queries";
|
||||
import {
|
||||
ACCOUNT_NOT_EXIST_ERROR,
|
||||
ACCOUNT_NOT_EXIST_MESSAGE,
|
||||
INSUFFICIENT_GAS_ERROR,
|
||||
INSUFFICIENT_GAS_MESSAGE,
|
||||
KEPLR_NOT_FOUND_ERROR,
|
||||
TWITTER_LOGIN_ERROR,
|
||||
VERIFICATION_THRESHOLD_ERROR,
|
||||
VERIFICATION_THRESHOLD_MESSAGE,
|
||||
} from "../../constants/error-message";
|
||||
import { makeClaimMessage, makeSetRecordMessage } from "../../messages";
|
||||
import Axios from "axios";
|
||||
@ -428,6 +434,26 @@ export default function VerificationPage() {
|
||||
}
|
||||
} catch (error) {
|
||||
if (Axios.isAxiosError(error)) {
|
||||
const message = (error?.response?.data as QueryError).message;
|
||||
|
||||
if (message.includes(INSUFFICIENT_GAS_ERROR)) {
|
||||
setErrorMessage({ message: INSUFFICIENT_GAS_MESSAGE });
|
||||
setErrorModalOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.includes(ACCOUNT_NOT_EXIST_ERROR)) {
|
||||
setErrorMessage({ message: ACCOUNT_NOT_EXIST_MESSAGE });
|
||||
setErrorModalOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.includes(VERIFICATION_THRESHOLD_ERROR)) {
|
||||
setErrorMessage({ message: VERIFICATION_THRESHOLD_MESSAGE });
|
||||
setErrorModalOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setErrorMessage({
|
||||
message: (error?.response?.data as QueryError).message,
|
||||
});
|
||||
@ -437,6 +463,7 @@ export default function VerificationPage() {
|
||||
|
||||
if (error instanceof Error) {
|
||||
console.log(error.message);
|
||||
|
||||
setErrorMessage({ message: error.message });
|
||||
setErrorModalOpen(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user