mirror of
https://github.com/ld3z/new-manga.git
synced 2026-11-09 20:23:45 -07:00
add more error logging for importing and vercel db improvements
This commit is contained in:
parent
f84046c66c
commit
80e7fe5c92
3 changed files with 126 additions and 7 deletions
|
|
@ -45,7 +45,21 @@ export const GET: APIRoute = async ({ params }) => {
|
|||
const errorMessage = error instanceof Error
|
||||
? `Internal server error: ${error.message}`
|
||||
: "Internal server error";
|
||||
|
||||
// Add specific error codes for better client-side handling
|
||||
let statusCode = 500;
|
||||
let friendlyMessage = errorMessage;
|
||||
|
||||
if (error instanceof Error) {
|
||||
if (error.message.includes('ETIMEDOUT')) {
|
||||
friendlyMessage = `Database connection timeout. This is often temporary, especially after server idle periods. Please try again in a few seconds.`;
|
||||
} else if (error.message.includes('ECONNREFUSED')) {
|
||||
friendlyMessage = `Database connection refused. The service may be temporarily unavailable.`;
|
||||
} else if (error.message.includes('ENOTFOUND')) {
|
||||
friendlyMessage = `Database host not found. There may be a configuration issue.`;
|
||||
}
|
||||
}
|
||||
|
||||
return new Response(errorMessage, { status: 500 });
|
||||
return new Response(friendlyMessage, { status: statusCode });
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue