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
+10 -6
View File
@@ -116,12 +116,16 @@ async def api_ticket_make_ticket(form_id):
nwords = len(re.split(r"\s+", g.data["ltext"]))
sats = g.data["sats"]
payment_hash, payment_request = await create_invoice(
wallet_id=form.wallet,
amount=sats,
memo=f"ticket with {nwords} words on {form_id}",
extra={"tag": "lnticket"},
)
try:
payment_hash, payment_request = await create_invoice(
wallet_id=form.wallet,
amount=sats,
memo=f"ticket with {nwords} words on {form_id}",
extra={"tag": "lnticket"},
)
except Exception as e:
return jsonify({"message": str(e)}), HTTPStatus.INTERNAL_SERVER_ERROR
ticket = await create_ticket(
payment_hash=payment_hash, wallet=form.wallet, **g.data