Skip to content

Commit

Permalink
Return better NWC error code for payment failures
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Apr 30, 2024
1 parent 75e295d commit dc848d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mutiny-core/src/nostr/nwc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,10 +1038,16 @@ impl NostrWalletConnect {
}
}

let code = if e == MutinyError::InsufficientBalance {
ErrorCode::InsufficientBalance
} else {
ErrorCode::PaymentFailed
};

Response {
result_type: Method::PayInvoice,
error: Some(NIP47Error {
code: ErrorCode::InsufficientBalance,
code,
message: format!("Failed to pay invoice: {e}"),
}),
result: None,
Expand Down

0 comments on commit dc848d3

Please sign in to comment.