🧑‍💻 Error

Error Format

The error messages generated on the Face Wallet SDK look like the following:

  • code: This is the code of the error that occurred.
  • message: This message describes the error that occurred.
  • data: The data associated with the error.
  • origin: This is the cause of why the error occurred.
  • isFaceError: This value is always true if the error is FaceError.
{
		"code": "{ERROR_CODE}",
		"message": "Face Error: [{ERROR_CODE}] {ERROR MESSAGE}",
		"data": {
			// extra data
		},
		"origin": "{ORIGIN_ERROR}"
}

Error Code

General Error (40xx)

CodeNameDescription
4000INVALID_ARGUMENTThe parameters were invalid.
4001USER_REJECTED_REQUESTThe request was rejected by the user.
This occurs when the user closes the face modal before completing the process for the request. For example, if a user is on a screen to enter a pincode during the transaction transfer process and closes the modal without completing the task, this error occurs.
Except that this error does not occur in face.wallet.home().
4002NOT_IMPLEMENTEDThe feature is not yet implemented.
4003BAD_REQUESTFace Wallet cannot process the request.
4004SEND_TRANSACTION_FAILEDTransaction sending is failed.

Auth Error (41xx)

CodeNameDescription
4100UNAUTHORIZEDThis occurs when the domain is invalid or the API key is invalid. If you get a message invalid api key error, Please check whether the API Key is correct and whether you have confused between the API Key for mainnet and that for testnet.
If you get a message invalid host name error instead, Please check your hostname in your dashboard.
4101NO_USER_DATAThis occurs when something goes wrong during the login process and there is no user data.
4102AUTHENTICATIONThis occurs when user closed the social login popup.
4103UNSUPPORTED_SOCIAL_PROVIDERThe provider is not supported.

Initialization Error (42xx)

CodeNameDescription
4200INVALID_ENVIRONMENTInvalid environment.
4201UNSUPPORTED_METHODThe RPC method is not supported.
4202UNSUPPORTED_CHAINThe blockchain is not supported.

Face Wallet Kit Error (43xx)

CodeNameDescription
4300INVALID_WALLETInvalid wallet.
4301PROVIDERS_AND_WALLETS_CONFIG_ERRORErrors in the provider and wallet arguments passed in when initializing Kit.

OnRamp Error (44xx)

CodeNameDescription
4400NO_COIN_AVAILABLE_TO_BUYThis occurs when no coins are available for purchase.
The coins available for purchase are the result of filtering the coins you have registered in the Dashboard by the arguments you passed in.

BORA Error (49xx)

CodeNameDescription
4906INVALID_SIGNATURE_MESSAGEThis occurs if the signature given as an argument when connecting is invalid.
4907INVALID_BORA_API_AND_SECRET_KEYThis occurs if the dapp's borafortal id/secret is not in the DB.
4909ALREADY_CONNECTED_OTHER_BAPP_USNThis occurs when the wallet is already connected with another BAPP USN.
For example, suppose a user named A in a DApp has already connected to wallet 0xabcd. If the user creates a new account B and tries to connect this new account to wallet 0xabcd, this error (ALREADY_CONNECTED_OTHER_BAPP_USN) will occur.
4910BORA_SERVICE_REGION_IS_WRONGThis occurs when calling connect/isConnected by a Dapp on the not supported region.

Internal Error

CodeNameDescription
5000INTERNALInternal error.

Example

import { Face, Network, FaceErrorCode } from '@haechi-labs/face-sdk';

const face = new Face({
  network: Network.GOELRI, 
  apiKey: 'YOUR_DAPP_API_KEY'
});

try {
	await face.wallet.home(); // All available networks
} catch (e) {
	if(e.isFaceError) {
		switch (e.code) {
			case FaceErrorCode.USER_REJECTED_REQUEST:
				console.log('User rejected request');
				break;
		}
	}
}