Skip to content

Commit

Permalink
fix: add route.ts exception capture (langgenius#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoliang1-jk committed Apr 16, 2024
1 parent 83c9e72 commit 9211a7e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/api/parameters/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import { client, getInfo, setSession } from '@/app/api/utils/common'

export async function GET(request: NextRequest) {
const { sessionId, user } = getInfo(request)
const { data } = await client.getApplicationParameters(user)
return NextResponse.json(data as object, {
headers: setSession(sessionId),
})
try {
const { data } = await client.getApplicationParameters(user)
return NextResponse.json(data as object, {
headers: setSession(sessionId),
})
}
catch (error) {
return NextResponse.json([])
}
}

0 comments on commit 9211a7e

Please sign in to comment.