feat: improve error reporting for wallet payments

This commit is contained in:
2023-05-17 16:30:23 +01:00
parent 202b9933e0
commit 167f1c5e65
4 changed files with 46 additions and 6 deletions

View File

@ -123,7 +123,7 @@ export default class LNDHubWallet implements LNWallet {
},
});
const json = await rsp.json();
if ("error" in json) {
if ("code" in json && !rsp.ok) {
const err = json as ErrorResponse;
throw new WalletError(err.code, err.message);
}