feat(panel web): NOT_JSON 错误日志补 响应长度+尾部 200 字节(定位截断点)
This commit is contained in:
1 parent
c730333776
commit
bc9ba3693f
1 file changed
+1
-1
@@ -177,7 +177,7 @@
|
|||||||
try { json = text ? JSON.parse(text) : null; } catch (e) { json = null; }
|
try { json = text ? JSON.parse(text) : null; } catch (e) { json = null; }
|
||||||
if (!json || typeof json.ok !== 'boolean') {
|
if (!json || typeof json.ok !== 'boolean') {
|
||||||
// 静态服务器返回 HTML / 404 等
|
// 静态服务器返回 HTML / 404 等
|
||||||
dbgErr(method || 'GET', path, 'HTTP', res.status, ms + 'ms', '非 JSON 响应, 原始内容头:', text.slice(0, 300));
|
dbgErr(method || 'GET', path, 'HTTP', res.status, ms + 'ms', '非 JSON 响应, len=' + text.length, '头:', text.slice(0, 200), '尾:', text.slice(-200));
|
||||||
setConn(res.ok ? true : false);
|
setConn(res.ok ? true : false);
|
||||||
throw { code: 'NOT_JSON', message: '后端返回了非 JSON 响应(HTTP ' + res.status + ')', status: res.status };
|
throw { code: 'NOT_JSON', message: '后端返回了非 JSON 响应(HTTP ' + res.status + ')', status: res.status };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user