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",
|
||||
"version": "0.0.37",
|
||||
"version": "0.0.38",
|
||||
"main": "dist/query-browser.js",
|
||||
"private": false,
|
||||
"type": "module",
|
||||
|
||||
@@ -124,11 +124,14 @@ export const adapter = async (opts: AdapterOpts = {}, overloadOpts?: RequestInit
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.name === 'AbortError') {
|
||||
console.log('Request timed out and was aborted');
|
||||
return {
|
||||
code: 408,
|
||||
message: '请求超时',
|
||||
}
|
||||
}
|
||||
console.error(err);
|
||||
return {
|
||||
code: 500,
|
||||
message: err.message || '网络错误',
|
||||
};
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user