From 2856803ca700b7a634af92bf135ec5a4004a82a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Thu, 30 Oct 2025 08:07:25 +0100 Subject: [PATCH] fix: handle all lnurl exceptions on lnurlscan endpoint (#3451) --- lnbits/core/views/lnurl_api.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lnbits/core/views/lnurl_api.py b/lnbits/core/views/lnurl_api.py index ff701bc6..d7f6e5cb 100644 --- a/lnbits/core/views/lnurl_api.py +++ b/lnbits/core/views/lnurl_api.py @@ -6,16 +6,17 @@ from fastapi import ( Depends, HTTPException, ) -from lnurl import LnurlResponseException -from lnurl import execute_login as lnurlauth -from lnurl import handle as lnurl_handle -from lnurl.models import ( +from lnurl import ( LnurlAuthResponse, LnurlErrorResponse, + LnurlException, LnurlPayResponse, - LnurlResponseModel, + LnurlResponseException, LnurlWithdrawResponse, ) +from lnurl import execute_login as lnurlauth +from lnurl import handle as lnurl_handle +from lnurl.models import LnurlResponseModel from loguru import logger from lnbits.core.models import Payment @@ -38,7 +39,7 @@ async def _handle(lnurl: str) -> LnurlResponseModel: res = await lnurl_handle(lnurl, user_agent=settings.user_agent, timeout=5) if isinstance(res, LnurlErrorResponse): raise HTTPException(status_code=HTTPStatus.BAD_REQUEST, detail=res.reason) - except LnurlResponseException as exc: + except LnurlException as exc: raise HTTPException( status_code=HTTPStatus.BAD_REQUEST, detail=str(exc) ) from exc