@kine-design/crud 0.0.1-beta.17 → 0.0.1-beta.18

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.
@@ -373,6 +373,13 @@ export class RequestBuilder {
373
373
  if (error instanceof NetworkRequestError && error.detail.type === 'httpError' && error.detail.status === 401) {
374
374
  onUnauthorized?.();
375
375
  }
376
+ // 写操作失败自动反馈错误信息
377
+ if (this.context.feedback) {
378
+ const msg = error instanceof BusinessError ? error.message
379
+ : error instanceof NetworkRequestError ? `请求失败: ${error.message}`
380
+ : '操作失败';
381
+ this.context.feedback.showError(msg);
382
+ }
376
383
  throw error;
377
384
  } finally {
378
385
  if (totalTimeoutId !== undefined) clearTimeout(totalTimeoutId);
package/dist/crud.js CHANGED
@@ -8399,6 +8399,10 @@ var RequestBuilder = class {
8399
8399
  return finalResult;
8400
8400
  } catch (error) {
8401
8401
  if (error instanceof NetworkRequestError && error.detail.type === "httpError" && error.detail.status === 401) onUnauthorized?.();
8402
+ if (this.context.feedback) {
8403
+ const msg = error instanceof BusinessError ? error.message : error instanceof NetworkRequestError ? `请求失败: ${error.message}` : "操作失败";
8404
+ this.context.feedback.showError(msg);
8405
+ }
8402
8406
  throw error;
8403
8407
  } finally {
8404
8408
  if (totalTimeoutId !== void 0) clearTimeout(totalTimeoutId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kine-design/crud",
3
- "version": "0.0.1-beta.17",
3
+ "version": "0.0.1-beta.18",
4
4
  "type": "module",
5
5
  "main": "./dist/crud.js",
6
6
  "types": "./dist/index.d.ts",