a special error for when payments fail.
This commit is contained in:
@@ -29,6 +29,10 @@ from .crud import (
|
||||
)
|
||||
|
||||
|
||||
class PaymentFailure(Exception):
|
||||
pass
|
||||
|
||||
|
||||
async def create_invoice(
|
||||
*,
|
||||
wallet_id: str,
|
||||
@@ -162,8 +166,9 @@ async def pay_invoice(
|
||||
)
|
||||
await delete_payment(temp_id, conn=conn)
|
||||
else:
|
||||
raise Exception(
|
||||
payment.error_message or "Failed to pay_invoice on backend."
|
||||
raise PaymentFailure(
|
||||
payment.error_message
|
||||
or "Payment failed, but backend didn't give us an error message."
|
||||
)
|
||||
|
||||
return invoice.payment_hash
|
||||
|
||||
Reference in New Issue
Block a user