@kevisual/query 0.0.37 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,11 +103,14 @@ const adapter = async (opts = {}, overloadOpts) => {
103
103
  })
104
104
  .catch((err) => {
105
105
  if (err.name === 'AbortError') {
106
- console.log('Request timed out and was aborted');
106
+ return {
107
+ code: 408,
108
+ message: '请求超时',
109
+ };
107
110
  }
108
- console.error(err);
109
111
  return {
110
112
  code: 500,
113
+ message: err.message || '网络错误',
111
114
  };
112
115
  })
113
116
  .finally(() => {
@@ -102,11 +102,14 @@ const adapter = async (opts = {}, overloadOpts) => {
102
102
  })
103
103
  .catch((err) => {
104
104
  if (err.name === 'AbortError') {
105
- console.log('Request timed out and was aborted');
105
+ return {
106
+ code: 408,
107
+ message: '请求超时',
108
+ };
106
109
  }
107
- console.error(err);
108
110
  return {
109
111
  code: 500,
112
+ message: err.message || '网络错误',
110
113
  };
111
114
  })
112
115
  .finally(() => {
package/dist/query.js CHANGED
@@ -102,11 +102,14 @@ const adapter = async (opts = {}, overloadOpts) => {
102
102
  })
103
103
  .catch((err) => {
104
104
  if (err.name === 'AbortError') {
105
- console.log('Request timed out and was aborted');
105
+ return {
106
+ code: 408,
107
+ message: '请求超时',
108
+ };
106
109
  }
107
- console.error(err);
108
110
  return {
109
111
  code: 500,
112
+ message: err.message || '网络错误',
110
113
  };
111
114
  })
112
115
  .finally(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/query",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "main": "dist/query-browser.js",
5
5
  "private": false,
6
6
  "type": "module",
package/src/adapter.ts CHANGED
@@ -124,11 +124,14 @@ export const adapter = async (opts: AdapterOpts = {}, overloadOpts?: RequestInit
124
124
  })
125
125
  .catch((err) => {
126
126
  if (err.name === 'AbortError') {
127
- console.log('Request timed out and was aborted');
127
+ return {
128
+ code: 408,
129
+ message: '请求超时',
130
+ }
128
131
  }
129
- console.error(err);
130
132
  return {
131
133
  code: 500,
134
+ message: err.message || '网络错误',
132
135
  };
133
136
  })
134
137
  .finally(() => {