There needs to be improvement on this code for proper error handling
Add Error Handling: Include error handling in case the redirect fails or if there are issues with the request.
async function getResponse(req: NextRequest): Promise<NextResponse> {
try {
return NextResponse.redirect('https://redirect-frame.vercel.app/redirect', { status: 302 });
} catch (error) {
console.error('Error during redirect:', error);
return NextResponse.error();
}
}
There needs to be improvement on this code for proper error handling
Add Error Handling: Include error handling in case the redirect fails or if there are issues with the request.
async function getResponse(req: NextRequest): Promise<NextResponse> {
try {
return NextResponse.redirect('https://redirect-frame.vercel.app/redirect', { status: 302 });
} catch (error) {
console.error('Error during redirect:', error);
return NextResponse.error();
}
}