From ff86f9f3b5b1a5e11f658fec8b0ee248f280c1f3 Mon Sep 17 00:00:00 2001 From: Joey Zhou Date: Thu, 12 Dec 2024 12:23:40 -0800 Subject: [PATCH 1/2] fix: log and not trigger sentry --- src/app/api/v1/user/welcome-scan/create/route.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/api/v1/user/welcome-scan/create/route.ts b/src/app/api/v1/user/welcome-scan/create/route.ts index 23ddf66d2bc..7f913226f6f 100644 --- a/src/app/api/v1/user/welcome-scan/create/route.ts +++ b/src/app/api/v1/user/welcome-scan/create/route.ts @@ -57,7 +57,10 @@ export async function POST( getCountryCode(headers()), ); if (!eligible) { - throw new Error("User is not eligible for feature"); + logger.error("scan_created_error", { + message: "User is not eligible for feature", + }); + return NextResponse.json({ success: false }, { status: 422 }); } const params: UserInfo = await req.json(); From 1d870c767ba584de1e40a4a142611d99b85b30d6 Mon Sep 17 00:00:00 2001 From: Joey Zhou Date: Fri, 13 Dec 2024 06:48:21 -0800 Subject: [PATCH 2/2] fix: review comment --- src/app/api/v1/user/welcome-scan/create/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/v1/user/welcome-scan/create/route.ts b/src/app/api/v1/user/welcome-scan/create/route.ts index 7f913226f6f..9ca69454ce4 100644 --- a/src/app/api/v1/user/welcome-scan/create/route.ts +++ b/src/app/api/v1/user/welcome-scan/create/route.ts @@ -57,7 +57,7 @@ export async function POST( getCountryCode(headers()), ); if (!eligible) { - logger.error("scan_created_error", { + logger.warn("scan_created_warn", { message: "User is not eligible for feature", }); return NextResponse.json({ success: false }, { status: 422 });