fix: 在API错误信息中包含响应体内容
This commit is contained in:
2
index.js
2
index.js
@@ -58,7 +58,7 @@ async function fetchApi(token, query) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (statusCode !== 200) {
|
if (statusCode !== 200) {
|
||||||
throw new Error(`API Status Code: ${statusCode}`);
|
throw new Error(`API Status Code: ${statusCode}, ${await body.text()}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await body.json();
|
const data = await body.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user