chore: bump version to 0.0.38 and update error handling in adapter for timeout and network errors

This commit is contained in:
2026-01-21 23:07:23 +08:00
parent 56b3976bc9
commit cb29e2ca67
2 changed files with 6 additions and 3 deletions

View File

@@ -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",

View File

@@ -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(() => {