Skip to content

Commit

Permalink
cli: enrich transfer errors with PFS error details
Browse files Browse the repository at this point in the history
The plain message that the PFS returned an error is not helpful for the
user. Therefore the error details get appended in case they exist.
  • Loading branch information
weilbith committed Jun 18, 2020
1 parent e4f3931 commit 69913e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions raiden-cli/src/routes/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ async function doTransfer(this: Cli, request: Request, response: Response, next:
request.body.amount,
{ paymentId: request.body.identifier },
);
this.log.info(`Transfer key: ${transferKey}`);
await this.raiden.waitTransfer(transferKey);
const newTransfer = await this.raiden.transfers$
.pipe(first(({ key }: RaidenTransfer) => key === transferKey))
Expand All @@ -53,7 +52,8 @@ async function doTransfer(this: Cli, request: Request, response: Response, next:
if (isInvalidParameterError(error)) {
response.status(400).send(error.message);
} else if (isConflictError(error)) {
response.status(409).send(error.message);
const pfsErrorDetail = error.details?.errors ? ` (${error.details.errors})` : '';
response.status(409).send(error.message + pfsErrorDetail);
} else {
next(error);
}
Expand Down

0 comments on commit 69913e8

Please sign in to comment.