-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Milestone
Description
The issue:
Here is an example response:
{
...
res: {
...
data: {
...
errors: [
'Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: invalid account data for instruction'
],
},
},
}
The SDK/API correctly tells me that there is an error when trying to process a payment. In this case the issue is that the destination address doesn't exist.
The problem is, the error message is far too long, and possibly subject to change. In our code, it is not realistic to write something like:
if (response.res.data.errors[0] === 'Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: invalid account data for instruction') {
console.log('Destination account doesn\'t exist!');
}
The solution:
It would be better if the client received an error from a known list of possible options. For example, the above example should return "DestinationNotFound" or something like that.
The existing Node SDK that uses Agora has the following error mesages:
AccountExists,
AccountDoesNotExist,
Malformed,
SenderDoesNotExist,
DestinationDoesNotExist,
InsufficientBalance,
InsufficientFee,
TransactionRejected,
AlreadyPaid,
WrongDestination,
SkuNotFound,
BadNonce,
AlreadySubmitted,
NoTokenAccounts,
Metadata
Metadata
Assignees
Labels
No labels