@entropic-bond/crud-panel 3.4.5 → 3.4.6
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.
package/lib/crud-controller.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface CrudControllerEvent<T extends EntropicComponent> {
|
|
|
6
6
|
documentChanged?: T;
|
|
7
7
|
documentCollection?: T[] | readonly T[];
|
|
8
8
|
action?: CrudControllerAction;
|
|
9
|
-
error?:
|
|
9
|
+
error?: Error;
|
|
10
10
|
}
|
|
11
11
|
export declare abstract class CrudController<T extends EntropicComponent> {
|
|
12
12
|
constructor(document?: T);
|
|
@@ -27,6 +27,7 @@ export declare abstract class CrudController<T extends EntropicComponent> {
|
|
|
27
27
|
setDocument(value: T): CrudController<T>;
|
|
28
28
|
set document(value: T);
|
|
29
29
|
get document(): T;
|
|
30
|
+
protected errorToError(error: any): Error;
|
|
30
31
|
protected progressController: ProgressController;
|
|
31
32
|
protected onChangeHdl: Observable<CrudControllerEvent<T>>;
|
|
32
33
|
private _model;
|
package/lib/crud-controller.js
CHANGED
|
@@ -48,7 +48,7 @@ class CrudController {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
|
-
this.onChangeHdl.notify({ error });
|
|
51
|
+
this.onChangeHdl.notify({ error: this.errorToError(error) });
|
|
52
52
|
}
|
|
53
53
|
finally {
|
|
54
54
|
this.progressController.notifyBusy(false, progressStage);
|
|
@@ -67,7 +67,7 @@ class CrudController {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
catch (error) {
|
|
70
|
-
this.onChangeHdl.notify({ error });
|
|
70
|
+
this.onChangeHdl.notify({ error: this.errorToError(error) });
|
|
71
71
|
}
|
|
72
72
|
finally {
|
|
73
73
|
this.progressController.notifyBusy(false, progressStage);
|
|
@@ -82,7 +82,7 @@ class CrudController {
|
|
|
82
82
|
var found = yield this.findDocs(limit);
|
|
83
83
|
}
|
|
84
84
|
catch (error) {
|
|
85
|
-
this.onChangeHdl.notify({ error });
|
|
85
|
+
this.onChangeHdl.notify({ error: this.errorToError(error) });
|
|
86
86
|
}
|
|
87
87
|
finally {
|
|
88
88
|
this.progressController.notifyBusy(false, progressStage);
|
|
@@ -112,6 +112,17 @@ class CrudController {
|
|
|
112
112
|
get document() {
|
|
113
113
|
return this._document;
|
|
114
114
|
}
|
|
115
|
+
errorToError(error) {
|
|
116
|
+
if (error instanceof Error)
|
|
117
|
+
return error;
|
|
118
|
+
if (typeof error === 'string')
|
|
119
|
+
return new Error(error);
|
|
120
|
+
if ('code' in error)
|
|
121
|
+
return new Error(error.code);
|
|
122
|
+
if ('message' in error)
|
|
123
|
+
return new Error(error.error);
|
|
124
|
+
return new Error(JSON.stringify(error));
|
|
125
|
+
}
|
|
115
126
|
}
|
|
116
127
|
exports.CrudController = CrudController;
|
|
117
128
|
//# sourceMappingURL=crud-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud-controller.js","sourceRoot":"","sources":["../src/crud-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA6G;AAC7G,+DAAyE;AAYzE,MAAsB,cAAc;IACnC,YAAa,QAAY;
|
|
1
|
+
{"version":3,"file":"crud-controller.js","sourceRoot":"","sources":["../src/crud-controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA6G;AAC7G,+DAAyE;AAYzE,MAAsB,cAAc;IACnC,YAAa,QAAY;QA2Hf,uBAAkB,GAAuB,IAAI,wCAAkB,EAAE,CAAA;QACjE,gBAAW,GAAuC,IAAI,0BAAU,EAA0B,CAAA;QA3HnG,IAAI,CAAC,WAAW,CAAE,QAAQ,IAAI,IAAI,CAAC,cAAc,EAAE,CAAE,CAAA;IACtD,CAAC;IAMS,QAAQ;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAE,IAAI,CAAC,QAAQ,CAAE,CAAA;IACxC,CAAC;IAES,SAAS;QAClB,OA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