chore: bump version to 0.0.38 and update error handling in adapter for timeout and network errors
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/query",
|
"name": "@kevisual/query",
|
||||||
"version": "0.0.37",
|
"version": "0.0.38",
|
||||||
"main": "dist/query-browser.js",
|
"main": "dist/query-browser.js",
|
||||||
"private": false,
|
"private": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -124,11 +124,14 @@ export const adapter = async (opts: AdapterOpts = {}, overloadOpts?: RequestInit
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.name === 'AbortError') {
|
if (err.name === 'AbortError') {
|
||||||
console.log('Request timed out and was aborted');
|
return {
|
||||||
|
code: 408,
|
||||||
|
message: '请求超时',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.error(err);
|
|
||||||
return {
|
return {
|
||||||
code: 500,
|
code: 500,
|
||||||
|
message: err.message || '网络错误',
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user