fix: catch all exceptions for webhook

This commit is contained in:
Vlad Stan 2022-12-19 19:41:10 +02:00
parent 9fed2f2ae0
commit 681883a8f9

View file

@ -2,6 +2,7 @@ import asyncio
import json import json
import httpx import httpx
from loguru import logger
from lnbits.core import db as core_db from lnbits.core import db as core_db
from lnbits.core.models import Payment from lnbits.core.models import Payment
@ -50,7 +51,8 @@ async def on_invoice_paid(payment: Payment) -> None:
r = await client.post(pay_link.webhook_url, **kwargs) r = await client.post(pay_link.webhook_url, **kwargs)
await mark_webhook_sent(payment, r.status_code) await mark_webhook_sent(payment, r.status_code)
except (httpx.ConnectError, httpx.RequestError): except Exception as ex:
logger.error(ex)
await mark_webhook_sent(payment, -1) await mark_webhook_sent(payment, -1)