@hmcts/ccd-case-ui-toolkit 7.0.2 → 7.0.3-error-message-fix
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/esm2020/lib/shared/components/palette/document/write-document-field.component.mjs +14 -2
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs +13 -1
- package/fesm2015/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs +13 -1
- package/fesm2020/hmcts-ccd-case-ui-toolkit.mjs.map +1 -1
- package/lib/shared/components/palette/document/write-document-field.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -12689,7 +12689,19 @@ class WriteDocumentFieldComponent extends AbstractFieldWriteComponent {
|
|
|
12689
12689
|
if (0 === error.status || 502 === error.status) {
|
|
12690
12690
|
return WriteDocumentFieldComponent.UPLOAD_ERROR_NOT_AVAILABLE;
|
|
12691
12691
|
}
|
|
12692
|
-
|
|
12692
|
+
let errorMsg = 'Error uploading file';
|
|
12693
|
+
if (error && error?.error) {
|
|
12694
|
+
const fullError = error.error;
|
|
12695
|
+
const start = fullError.indexOf('{');
|
|
12696
|
+
if (start >= 0) {
|
|
12697
|
+
const json = fullError.substring(start, fullError.length - 1).split('<EOL>').join('');
|
|
12698
|
+
const obj = JSON.parse(json);
|
|
12699
|
+
if (obj && obj?.error) {
|
|
12700
|
+
errorMsg = obj.error;
|
|
12701
|
+
}
|
|
12702
|
+
}
|
|
12703
|
+
}
|
|
12704
|
+
return errorMsg;
|
|
12693
12705
|
}
|
|
12694
12706
|
buildDocumentUploadData(selectedFile) {
|
|
12695
12707
|
const documentUpload = new FormData();
|