πŸ§‘β€πŸ’» 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)

Code

Name

Description

4000

INVALID_ARGUMENT

The parameters were invalid.

4001

USER_REJECTED_REQUEST

The 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().

4002

NOT_IMPLEMENTED

The feature is not yet implemented.

4003

BAD_REQUEST

Face Wallet cannot process the request.

4004

SEND_TRANSACTION_FAILED

Transaction sending is failed.

Auth Error (41xx)

Code

Name

Description

4100

UNAUTHORIZED

This 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.

4101

NO_USER_DATA

This occurs when something goes wrong during the login process and there is no user data.

4102

AUTHENTICATION

This occurs when user closed the social login popup.

4103

UNSUPPORTED_SOCIAL_PROVIDER

The 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)

Code

Name

Description

4400

NO_COIN_AVAILABLE_TO_BUY

This 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)

Code

Name

Description

4906

INVALID_SIGNATURE_MESSAGE

This occurs if the signature given as an argument when connecting is invalid.

4907

INVALID_BORA_API_AND_SECRET_KEY

This occurs if the dapp's borafortal id/secret is not in the DB.

4909

ALREADY_CONNECTED_OTHER_BAPP_USN

This 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.

4910

BORA_SERVICE_REGION_IS_WRONG

This 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;
		}
	}
}