@messaia/cdk 22.0.1-rc.23 → 22.0.1-rc.24
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/fesm2022/messaia-cdk.mjs
CHANGED
|
@@ -1587,6 +1587,13 @@ class BaseComponent {
|
|
|
1587
1587
|
if (errorCallback) {
|
|
1588
1588
|
errorCallback(errors);
|
|
1589
1589
|
}
|
|
1590
|
+
else {
|
|
1591
|
+
/* Provide visible feedback when the caller has no custom error handler */
|
|
1592
|
+
this.parseErrors(errors);
|
|
1593
|
+
if (this.errors.length) {
|
|
1594
|
+
this.showMessage(this.errors.join('\n'), MessageType.Error);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1590
1597
|
}
|
|
1591
1598
|
});
|
|
1592
1599
|
}
|
|
@@ -1898,6 +1905,21 @@ class BaseComponent {
|
|
|
1898
1905
|
this.errors = [];
|
|
1899
1906
|
this.isLoading = false;
|
|
1900
1907
|
this.isSaving = false;
|
|
1908
|
+
/* Keep plain error messages intact instead of iterating over their characters */
|
|
1909
|
+
if (typeof errors === 'string') {
|
|
1910
|
+
this.errors.push(errors);
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
/* Extract user-facing fields from RFC problem responses and ignore transport metadata */
|
|
1914
|
+
if (typeof errors?.title === 'string' || typeof errors?.detail === 'string') {
|
|
1915
|
+
if (typeof errors.title === 'string') {
|
|
1916
|
+
this.errors.push(errors.title);
|
|
1917
|
+
}
|
|
1918
|
+
if (typeof errors.detail === 'string' && errors.detail !== errors.title) {
|
|
1919
|
+
this.errors.push(errors.detail);
|
|
1920
|
+
}
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1901
1923
|
/* If there are errors, iterate through them and add them to the errors array */
|
|
1902
1924
|
if (errors) {
|
|
1903
1925
|
Object.keys(errors).forEach(el => {
|
|
@@ -15336,6 +15358,10 @@ class GenericService {
|
|
|
15336
15358
|
if (error.error instanceof ArrayBuffer) {
|
|
15337
15359
|
return JSON.parse(new TextDecoder().decode(new Uint8Array(error.error)));
|
|
15338
15360
|
}
|
|
15361
|
+
/* Preserve structured API errors such as ASP.NET ProblemDetails */
|
|
15362
|
+
if (error.error && typeof error.error === 'object') {
|
|
15363
|
+
return error.error;
|
|
15364
|
+
}
|
|
15339
15365
|
const message = (error.error instanceof ErrorEvent) ? error.error.message : `server returned code ${error.status} with body "${error.error}"`;
|
|
15340
15366
|
return `${operation} failed: ${message}`;
|
|
15341
15367
|
});
|