Skip to content

Commit

Permalink
SEP-8: add op_no_trust and op_no_destination error codes (stellar#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelosalloum authored and quietbits committed Jul 29, 2021
1 parent 1515743 commit 78e82a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/helpers/getErrorString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export const TX_ERROR_TEXT: ErrorTextObject = {
op_malformed: "The input is incorrect and would result in an invalid offer.",
op_sell_no_trust: "You are not authorized to sell this asset.",
op_line_full: "You have reached the limit allowed for buying that asset.",
op_no_destination: "The destination account doesn't exist.",
op_no_trust:
"One or more accounts in this transaction doesn't have a trustline with the desired asset.",
op_underfunded: "You don’t have enough to cover that transaction.",
op_under_dest_min:
"We couldn’t complete your transaction at this time because the exchange rate offered is no longer available. Please try again.",
Expand Down Expand Up @@ -54,8 +57,8 @@ export function getErrorString(err: any): string {
const ignoredCodes = ["op_success"];
const message = codes
.filter((code: string) => !ignoredCodes.includes(code))
.map((code: string) => TX_ERROR_TEXT[code] || `Error code '${code}'`)
.join(", ");
.map((code: string) => TX_ERROR_TEXT[code] || `Error code '${code}'.`)
.join(" ");

if (message) {
return message;
Expand Down

0 comments on commit 78e82a4

Please sign in to comment.