mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-07 05:02:45 +08:00
fix service.js
This commit is contained in:
@@ -60,7 +60,7 @@ app.use(
|
||||
return proxyResData;
|
||||
}
|
||||
},
|
||||
// 统一错误处理
|
||||
// 统一错误处理(添加超时错误处理)
|
||||
proxyErrorHandler: (err, res, next) => {
|
||||
// 客户端断开连接的正常情况(常见于SSE)
|
||||
if (err.code === 'ECONNRESET' || err.code === 'EPIPE') {
|
||||
@@ -69,6 +69,15 @@ app.use(
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加超时错误处理
|
||||
if (err.code === 'ETIMEDOUT') {
|
||||
console.log('Proxy request timed out:', err.code);
|
||||
if (!res.headersSent) {
|
||||
res.status(504).send('Gateway Timeout');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 其他错误正常处理
|
||||
console.error('Proxy error:', err);
|
||||
next(err);
|
||||
|
||||
Reference in New Issue
Block a user