catch errors in multiple places that might be destroying the async flow and causing lnbits to die silently.

This commit is contained in:
fiatjaf
2021-04-10 17:37:48 -03:00
parent b48a44bcd0
commit fdf4f6c1ae
9 changed files with 82 additions and 55 deletions
+5 -1
View File
@@ -33,6 +33,10 @@ class PaymentFailure(Exception):
pass
class InvoiceFailure(Exception):
pass
async def create_invoice(
*,
wallet_id: str,
@@ -50,7 +54,7 @@ async def create_invoice(
amount=amount, memo=invoice_memo, description_hash=description_hash
)
if not ok:
raise Exception(error_message or "Unexpected backend error.")
raise InvoiceFailure(error_message or "Unexpected backend error.")
invoice = bolt11.decode(payment_request)