π§βπ» 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 alwaystrueif 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. |
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 |
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)
| Code | Name | Description |
|---|---|---|
| 4200 | INVALID_ENVIRONMENT | Invalid environment. |
| 4201 | UNSUPPORTED_METHOD | The RPC method is not supported. |
| 4202 | UNSUPPORTED_CHAIN | The blockchain is not supported. |
Face Wallet Kit Error (43xx)
| Code | Name | Description |
|---|---|---|
| 4300 | INVALID_WALLET | Invalid wallet. |
| 4301 | PROVIDERS_AND_WALLETS_CONFIG_ERROR | Errors 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. |
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. |
4910 | BORA_SERVICE_REGION_IS_WRONG | This occurs when calling |
Internal Error
| Code | Name | Description |
|---|---|---|
| 5000 | INTERNAL | Internal 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;
}
}
}Updated 8 days ago