@gridsuite/commons-ui 0.138.0 → 0.139.0
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/dist/components/cardErrorBoundary/CardErrorBoundary.d.ts +1 -1
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js +2 -6
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +2 -4
- package/dist/components/elementSearch/hooks/useElementSearch.js +2 -4
- package/dist/components/filter/FilterCreationDialog.js +3 -16
- package/dist/components/filter/expert/ExpertFilterEditionDialog.js +4 -23
- package/dist/components/filter/expert/expertFilterUtils.d.ts +0 -1
- package/dist/components/filter/expert/expertFilterUtils.js +0 -11
- package/dist/components/filter/expert/index.js +1 -2
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js +3 -7
- package/dist/components/filter/explicitNaming/ExplicitNamingFilterForm.js +2 -4
- package/dist/components/filter/index.js +1 -2
- package/dist/components/filter/utils/filterApi.js +1 -1
- package/dist/components/index.js +1 -2
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +7 -4
- package/dist/components/inputs/reactHookForm/OverflowableChipWithHelperText.js +1 -1
- package/dist/components/parameters/common/parameters-creation-dialog.js +4 -9
- package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +3 -6
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +3 -5
- package/dist/components/parameters/network-visualizations/network-visualizations-parameters-inline.js +2 -5
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +4 -12
- package/dist/components/parameters/security-analysis/security-analysis-parameters-inline.js +2 -5
- package/dist/components/parameters/security-analysis/use-security-analysis-parameters-form.js +3 -5
- package/dist/components/parameters/sensi/sensitivity-analysis-parameters-inline.js +3 -9
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +4 -12
- package/dist/components/parameters/short-circuit/short-circuit-parameters-inline.js +2 -5
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +5 -16
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +4 -12
- package/dist/components/parameters/voltage-init/voltage-init-parameters-inline.js +3 -8
- package/dist/hooks/use-parameters-backend.js +10 -20
- package/dist/hooks/usePredefinedProperties.js +2 -3
- package/dist/hooks/useSnackMessage.d.ts +1 -2
- package/dist/index.js +9 -4
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +1 -4
- package/dist/services/utils.d.ts +0 -1
- package/dist/services/utils.js +7 -10
- package/dist/translations/en/businessErrorsEn.d.ts +18 -0
- package/dist/translations/en/businessErrorsEn.js +19 -1
- package/dist/translations/en/equipmentShortEn.js +3 -3
- package/dist/translations/fr/businessErrorsFr.d.ts +18 -0
- package/dist/translations/fr/businessErrorsFr.js +19 -1
- package/dist/translations/fr/equipmentShortFr.js +3 -3
- package/dist/utils/error.d.ts +4 -0
- package/dist/utils/error.js +28 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/labelUtils.d.ts +8 -0
- package/dist/utils/labelUtils.js +17 -0
- package/dist/{services/businessErrorCode.d.ts → utils/types/CustomError.d.ts} +3 -1
- package/dist/utils/types/CustomError.js +20 -0
- package/dist/utils/types/index.d.ts +1 -0
- package/dist/utils/types/index.js +3 -0
- package/package.json +1 -1
- package/dist/services/businessErrorCode.js +0 -10
|
@@ -4,6 +4,7 @@ import { Box, Grid } from "@mui/material";
|
|
|
4
4
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
5
|
import "../../../utils/types/equipmentType.js";
|
|
6
6
|
import "../../../utils/conversionUtils.js";
|
|
7
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
7
8
|
import "@mui/icons-material";
|
|
8
9
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
9
10
|
import "../../../utils/yupConfig.js";
|
|
@@ -81,11 +82,7 @@ function ShortCircuitParametersInLine({
|
|
|
81
82
|
fetchShortCircuitParameters(paramUuid).then((parameters) => {
|
|
82
83
|
replaceFormValues(parameters);
|
|
83
84
|
}).catch((error) => {
|
|
84
|
-
|
|
85
|
-
snackError({
|
|
86
|
-
messageTxt: error.message,
|
|
87
|
-
headerId: "paramsRetrievingError"
|
|
88
|
-
});
|
|
85
|
+
snackWithFallback(snackError, error, { headerId: "paramsRetrievingError" });
|
|
89
86
|
});
|
|
90
87
|
}
|
|
91
88
|
setOpenSelectParameterDialog(false);
|
|
@@ -9,6 +9,7 @@ import "../../overflowableText/OverflowableText.js";
|
|
|
9
9
|
import "../../../utils/types/equipmentType.js";
|
|
10
10
|
import { updateParameter } from "../../../services/explore.js";
|
|
11
11
|
import "../../../utils/conversionUtils.js";
|
|
12
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
12
13
|
import "@mui/icons-material";
|
|
13
14
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
14
15
|
import { setStudyShortCircuitParameters, invalidateStudyShortCircuitStatus } from "../../../services/study.js";
|
|
@@ -145,17 +146,11 @@ const useShortCircuitParametersForm = ({
|
|
|
145
146
|
...prepareDataToSend(shortCircuitParameters, formData)
|
|
146
147
|
}).then(() => {
|
|
147
148
|
invalidateStudyShortCircuitStatus(studyUuid).catch((error) => {
|
|
148
|
-
snackError
|
|
149
|
-
messageTxt: error.message,
|
|
150
|
-
headerId: "invalidateShortCircuitStatusError"
|
|
151
|
-
});
|
|
149
|
+
snackWithFallback(snackError, error, { headerId: "invalidateShortCircuitStatusError" });
|
|
152
150
|
});
|
|
153
151
|
}).catch((error) => {
|
|
154
152
|
setShortCircuitParameters(oldParams);
|
|
155
|
-
snackError
|
|
156
|
-
messageTxt: error.message,
|
|
157
|
-
headerId: "paramsChangingError"
|
|
158
|
-
});
|
|
153
|
+
snackWithFallback(snackError, error, { headerId: "paramsChangingError" });
|
|
159
154
|
});
|
|
160
155
|
}
|
|
161
156
|
},
|
|
@@ -171,10 +166,7 @@ const useShortCircuitParametersForm = ({
|
|
|
171
166
|
ElementType.SHORT_CIRCUIT_PARAMETERS,
|
|
172
167
|
formData[DESCRIPTION] ?? ""
|
|
173
168
|
).catch((error) => {
|
|
174
|
-
snackError
|
|
175
|
-
messageTxt: error.message,
|
|
176
|
-
headerId: "paramsChangingError"
|
|
177
|
-
});
|
|
169
|
+
snackWithFallback(snackError, error, { headerId: "paramsChangingError" });
|
|
178
170
|
});
|
|
179
171
|
}
|
|
180
172
|
},
|
|
@@ -188,10 +180,7 @@ const useShortCircuitParametersForm = ({
|
|
|
188
180
|
fetchShortCircuitParameters(parametersUuid).then((params) => {
|
|
189
181
|
setShortCircuitParameters(params);
|
|
190
182
|
}).catch((error) => {
|
|
191
|
-
snackError
|
|
192
|
-
messageTxt: error.message,
|
|
193
|
-
headerId: "paramsRetrievingError"
|
|
194
|
-
});
|
|
183
|
+
snackWithFallback(snackError, error, { headerId: "paramsRetrievingError" });
|
|
195
184
|
}).finally(() => {
|
|
196
185
|
clearTimeout(timer);
|
|
197
186
|
setParamsLoading(false);
|
|
@@ -10,6 +10,7 @@ import "../../../utils/types/equipmentType.js";
|
|
|
10
10
|
import { updateParameter } from "../../../services/explore.js";
|
|
11
11
|
import { ID, FILTERS } from "../../../utils/constants/filterConstant.js";
|
|
12
12
|
import { isBlankOrEmpty } from "../../../utils/conversionUtils.js";
|
|
13
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
13
14
|
import "@mui/icons-material";
|
|
14
15
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
15
16
|
import { updateVoltageInitParameters } from "../../../services/study.js";
|
|
@@ -151,10 +152,7 @@ const useVoltageInitParametersForm = ({
|
|
|
151
152
|
if (studyUuid) {
|
|
152
153
|
updateVoltageInitParameters(studyUuid, fromVoltageInitParametersFormToParamValues(formData)).catch(
|
|
153
154
|
(error) => {
|
|
154
|
-
snackError
|
|
155
|
-
messageTxt: error.message,
|
|
156
|
-
headerId: "updateVoltageInitParametersError"
|
|
157
|
-
});
|
|
155
|
+
snackWithFallback(snackError, error, { headerId: "updateVoltageInitParametersError" });
|
|
158
156
|
}
|
|
159
157
|
);
|
|
160
158
|
}
|
|
@@ -171,10 +169,7 @@ const useVoltageInitParametersForm = ({
|
|
|
171
169
|
ElementType.VOLTAGE_INIT_PARAMETERS,
|
|
172
170
|
formData[DESCRIPTION] ?? ""
|
|
173
171
|
).catch((error) => {
|
|
174
|
-
snackError
|
|
175
|
-
messageTxt: error.message,
|
|
176
|
-
headerId: "updateVoltageInitParametersError"
|
|
177
|
-
});
|
|
172
|
+
snackWithFallback(snackError, error, { headerId: "updateVoltageInitParametersError" });
|
|
178
173
|
});
|
|
179
174
|
}
|
|
180
175
|
},
|
|
@@ -188,10 +183,7 @@ const useVoltageInitParametersForm = ({
|
|
|
188
183
|
getVoltageInitParameters(parametersUuid).then((params) => {
|
|
189
184
|
reset(fromVoltageInitParamsDataToFormValues(params));
|
|
190
185
|
}).catch((error) => {
|
|
191
|
-
snackError
|
|
192
|
-
messageTxt: error.message,
|
|
193
|
-
headerId: "paramsRetrievingError"
|
|
194
|
-
});
|
|
186
|
+
snackWithFallback(snackError, error, { headerId: "paramsRetrievingError" });
|
|
195
187
|
}).finally(() => {
|
|
196
188
|
clearTimeout(timer);
|
|
197
189
|
setParamsLoading(false);
|
|
@@ -4,6 +4,7 @@ import { Box, Grid } from "@mui/material";
|
|
|
4
4
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
5
|
import "../../../utils/types/equipmentType.js";
|
|
6
6
|
import "../../../utils/conversionUtils.js";
|
|
7
|
+
import { snackWithFallback } from "../../../utils/error.js";
|
|
7
8
|
import "@mui/icons-material";
|
|
8
9
|
import { ElementType } from "../../../utils/types/elementType.js";
|
|
9
10
|
import "../../../utils/yupConfig.js";
|
|
@@ -70,10 +71,7 @@ function VoltageInitParametersInLine({
|
|
|
70
71
|
keepDefaultValues: true
|
|
71
72
|
});
|
|
72
73
|
}).catch((error) => {
|
|
73
|
-
snackError
|
|
74
|
-
messageTxt: error.message,
|
|
75
|
-
headerId: "paramsRetrievingError"
|
|
76
|
-
});
|
|
74
|
+
snackWithFallback(snackError, error, { headerId: "paramsRetrievingError" });
|
|
77
75
|
});
|
|
78
76
|
}
|
|
79
77
|
setOpenSelectParameterDialog(false);
|
|
@@ -86,10 +84,7 @@ function VoltageInitParametersInLine({
|
|
|
86
84
|
computationParameters: null
|
|
87
85
|
// null means Reset
|
|
88
86
|
}).catch((error) => {
|
|
89
|
-
snackError
|
|
90
|
-
messageTxt: error.message,
|
|
91
|
-
headerId: "updateVoltageInitParametersError"
|
|
92
|
-
});
|
|
87
|
+
snackWithFallback(snackError, error, { headerId: "updateVoltageInitParametersError" });
|
|
93
88
|
});
|
|
94
89
|
setOpenResetConfirmation(false);
|
|
95
90
|
}, [studyUuid, snackError]);
|
|
@@ -2,6 +2,7 @@ import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
|
2
2
|
import { useSnackMessage } from "./useSnackMessage.js";
|
|
3
3
|
import { useDebounce } from "./useDebounce.js";
|
|
4
4
|
import { formatComputingTypeLabel } from "../components/parameters/common/computing-type.js";
|
|
5
|
+
import { snackWithFallback } from "../utils/error.js";
|
|
5
6
|
const INITIAL_PROVIDERS = {};
|
|
6
7
|
var OptionalServicesStatus = /* @__PURE__ */ ((OptionalServicesStatus2) => {
|
|
7
8
|
OptionalServicesStatus2["Up"] = "UP";
|
|
@@ -35,8 +36,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
35
36
|
setProvider(newProvider);
|
|
36
37
|
backendUpdateProvider?.(studyUuid, newProvider).catch((error) => {
|
|
37
38
|
setProvider(oldProvider);
|
|
38
|
-
snackError
|
|
39
|
-
messageTxt: error.message,
|
|
39
|
+
snackWithFallback(snackError, error, {
|
|
40
40
|
headerId: `update${formatComputingTypeLabel(type)}ProviderError`
|
|
41
41
|
});
|
|
42
42
|
});
|
|
@@ -53,8 +53,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}).catch((error) => {
|
|
56
|
-
snackError
|
|
57
|
-
messageTxt: error.message,
|
|
56
|
+
snackWithFallback(snackError, error, {
|
|
58
57
|
headerId: `fetchDefault${formatComputingTypeLabel(type)}ProviderError`
|
|
59
58
|
});
|
|
60
59
|
});
|
|
@@ -69,8 +68,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
69
68
|
}, {});
|
|
70
69
|
providersRef.current = providersObj;
|
|
71
70
|
}).catch((error) => {
|
|
72
|
-
snackError
|
|
73
|
-
messageTxt: error.message,
|
|
71
|
+
snackWithFallback(snackError, error, {
|
|
74
72
|
headerId: `fetch${formatComputingTypeLabel(type)}ProvidersError`
|
|
75
73
|
});
|
|
76
74
|
});
|
|
@@ -84,8 +82,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
84
82
|
resetProvider();
|
|
85
83
|
}
|
|
86
84
|
}).catch((error) => {
|
|
87
|
-
snackError
|
|
88
|
-
messageTxt: error.message,
|
|
85
|
+
snackWithFallback(snackError, error, {
|
|
89
86
|
headerId: `fetch${formatComputingTypeLabel(type)}ProviderError`
|
|
90
87
|
});
|
|
91
88
|
});
|
|
@@ -101,8 +98,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
101
98
|
backendFetchSpecificParametersDescription?.().then((specificParams) => {
|
|
102
99
|
setSpecificParamsDescription(specificParams);
|
|
103
100
|
}).catch((error) => {
|
|
104
|
-
snackError
|
|
105
|
-
messageTxt: error.message,
|
|
101
|
+
snackWithFallback(snackError, error, {
|
|
106
102
|
headerId: `fetch${formatComputingTypeLabel(type)}SpecificParametersError`
|
|
107
103
|
});
|
|
108
104
|
});
|
|
@@ -116,10 +112,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
116
112
|
backendFetchDefaultLimitReductions?.().then((defaultLimits) => {
|
|
117
113
|
setDefaultLimitReductions(defaultLimits);
|
|
118
114
|
}).catch((error) => {
|
|
119
|
-
snackError
|
|
120
|
-
messageTxt: error.message,
|
|
121
|
-
headerId: "fetchDefaultLimitReductionsError"
|
|
122
|
-
});
|
|
115
|
+
snackWithFallback(snackError, error, { headerId: "fetchDefaultLimitReductionsError" });
|
|
123
116
|
});
|
|
124
117
|
}, [backendFetchDefaultLimitReductions, snackError]);
|
|
125
118
|
useEffect(() => {
|
|
@@ -136,8 +129,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
136
129
|
} else {
|
|
137
130
|
setProvider(void 0);
|
|
138
131
|
}
|
|
139
|
-
snackError
|
|
140
|
-
messageTxt: error.message,
|
|
132
|
+
snackWithFallback(snackError, error, {
|
|
141
133
|
headerId: `update${formatComputingTypeLabel(type)}ParametersError`
|
|
142
134
|
});
|
|
143
135
|
});
|
|
@@ -172,8 +164,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
172
164
|
});
|
|
173
165
|
}
|
|
174
166
|
}).catch((error) => {
|
|
175
|
-
snackError
|
|
176
|
-
messageTxt: error.message,
|
|
167
|
+
snackWithFallback(snackError, error, {
|
|
177
168
|
headerId: `update${formatComputingTypeLabel(type)}ParametersError`
|
|
178
169
|
});
|
|
179
170
|
});
|
|
@@ -186,8 +177,7 @@ const useParametersBackend = (user, studyUuid, type, optionalServiceStatus, back
|
|
|
186
177
|
setProvider(_params.provider);
|
|
187
178
|
}
|
|
188
179
|
}).catch((error) => {
|
|
189
|
-
snackError
|
|
190
|
-
messageTxt: error.message,
|
|
180
|
+
snackWithFallback(snackError, error, {
|
|
191
181
|
headerId: `fetch${formatComputingTypeLabel(type)}ParametersError`
|
|
192
182
|
});
|
|
193
183
|
});
|
|
@@ -3,6 +3,7 @@ import { equipmentTypesForPredefinedPropertiesMapper } from "../utils/mapper/equ
|
|
|
3
3
|
import { useSnackMessage } from "./useSnackMessage.js";
|
|
4
4
|
import { fetchStudyMetadata } from "../services/appsMetadata.js";
|
|
5
5
|
import "../utils/conversionUtils.js";
|
|
6
|
+
import { snackWithFallback } from "../utils/error.js";
|
|
6
7
|
import "react/jsx-runtime";
|
|
7
8
|
import "@mui/icons-material";
|
|
8
9
|
import "../utils/types/equipmentType.js";
|
|
@@ -25,9 +26,7 @@ const usePredefinedProperties = (type) => {
|
|
|
25
26
|
setEquipmentPredefinedProps(p);
|
|
26
27
|
}
|
|
27
28
|
}).catch((error) => {
|
|
28
|
-
snackError
|
|
29
|
-
messageTxt: error.message ?? error
|
|
30
|
-
});
|
|
29
|
+
snackWithFallback(snackError, error);
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
}, [type, setEquipmentPredefinedProps, snackError]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { closeSnackbar as closeSnackbarFromNotistack, OptionsObject } from 'notistack';
|
|
2
|
-
interface SnackInputs extends Omit<OptionsObject, 'variant' | 'style'> {
|
|
2
|
+
export interface SnackInputs extends Omit<OptionsObject, 'variant' | 'style'> {
|
|
3
3
|
messageTxt?: string;
|
|
4
4
|
messageId?: string;
|
|
5
5
|
messageValues?: Record<string, string>;
|
|
@@ -15,4 +15,3 @@ export interface UseSnackMessageReturn {
|
|
|
15
15
|
closeSnackbar: typeof closeSnackbarFromNotistack;
|
|
16
16
|
}
|
|
17
17
|
export declare function useSnackMessage(): UseSnackMessageReturn;
|
|
18
|
-
export {};
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ import { ExpertFilterEditionDialog } from "./components/filter/expert/ExpertFilt
|
|
|
44
44
|
import { ExpertFilterForm, expertFilterSchema, getExpertFilterEmptyFormData } from "./components/filter/expert/ExpertFilterForm.js";
|
|
45
45
|
import { CombinatorType, DataType, OperatorType } from "./components/filter/expert/expertFilter.type.js";
|
|
46
46
|
import { COMBINATOR_OPTIONS, CONVERTERS_MODE_OPTIONS, ENERGY_SOURCE_OPTIONS, EXPERT_FILTER_EQUIPMENTS, EXPERT_FILTER_FIELDS, EXPERT_FILTER_QUERY, FIELDS_OPTIONS, LOAD_TYPE_OPTIONS, OPERATOR_OPTIONS, PHASE_REGULATION_MODE_OPTIONS, RATIO_REGULATION_MODE_OPTIONS, REGULATION_TYPE_OPTIONS, RULES, SHUNT_COMPENSATOR_TYPE_OPTIONS, SVAR_REGULATION_MODE_OPTIONS } from "./components/filter/expert/expertFilterConstants.js";
|
|
47
|
-
import { countRules, exportExpertRules,
|
|
47
|
+
import { countRules, exportExpertRules, getNumberOfSiblings, getOperators, importExpertRules, queryValidator, recursiveRemove, testQuery } from "./components/filter/expert/expertFilterUtils.js";
|
|
48
48
|
import { ExplicitNamingFilterEditionDialog } from "./components/filter/explicitNaming/ExplicitNamingFilterEditionDialog.js";
|
|
49
49
|
import { ExplicitNamingFilterForm, explicitNamingFilterSchema, getExplicitNamingFilterEmptyFormData } from "./components/filter/explicitNaming/ExplicitNamingFilterForm.js";
|
|
50
50
|
import { FILTER_EQUIPMENTS_ATTRIBUTES } from "./components/filter/explicitNaming/ExplicitNamingFilterConstants.js";
|
|
@@ -189,7 +189,7 @@ import { OptionalServicesStatus, useParametersBackend } from "./hooks/use-parame
|
|
|
189
189
|
import { useCreateRowDataSensi } from "./hooks/use-create-row-data-sensi.js";
|
|
190
190
|
import { LOGOUT_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, SIGNIN_CALLBACK_ERROR, UNAUTHORIZED_USER_INFO, USER, USER_VALIDATION_ERROR, resetAuthenticationRouterError, setLoggedUser, setLogoutError, setShowAuthenticationRouterLogin, setSignInCallbackError, setUnauthorizedUserInfo, setUserValidationError } from "./redux/actions/authActions.js";
|
|
191
191
|
import { getUserToken, setCommonStore } from "./redux/commonStore.js";
|
|
192
|
-
import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText,
|
|
192
|
+
import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList } from "./services/utils.js";
|
|
193
193
|
import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./services/explore.js";
|
|
194
194
|
import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
|
|
195
195
|
import { elementAlreadyExists, fetchConfigParameter, fetchConfigParameters, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, getAppName, updateConfigParameter } from "./services/directory.js";
|
|
@@ -200,7 +200,6 @@ import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin
|
|
|
200
200
|
import { getVoltageInitParameters, getVoltageInitUrl } from "./services/voltage-init.js";
|
|
201
201
|
import { getPccMinStudyParameters, updatePccMinParameters } from "./services/pcc-min.js";
|
|
202
202
|
import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./services/security-analysis.js";
|
|
203
|
-
import { CustomError } from "./services/businessErrorCode.js";
|
|
204
203
|
import { equalsArray } from "./utils/algos.js";
|
|
205
204
|
import { FetchStatus } from "./utils/constants/fetchStatus.js";
|
|
206
205
|
import { FieldConstants } from "./utils/constants/fieldConstants.js";
|
|
@@ -209,12 +208,14 @@ import { AMPERE, DEGREE, KILO_AMPERE, KILO_METER, KILO_VOLT, MEGA_VAR, MEGA_VOLT
|
|
|
209
208
|
import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES, LAST_SELECTED_DIRECTORY, PARAM_DEVELOPER_MODE, PARAM_LANGUAGE, PARAM_THEME } from "./utils/constants/configConstants.js";
|
|
210
209
|
import { FILTERS, FILTER_ID, FILTER_NAME, ID } from "./utils/constants/filterConstant.js";
|
|
211
210
|
import { GRIDSUITE_DEFAULT_PRECISION, convertInputValue, convertOutputValue, isBlankOrEmpty, kiloUnitToUnit, microUnitToUnit, roundToDefaultPrecision, roundToPrecision, unitToKiloUnit, unitToMicroUnit } from "./utils/conversionUtils.js";
|
|
211
|
+
import { catchErrorHandler, snackWithFallback } from "./utils/error.js";
|
|
212
212
|
import { areArrayElementsUnique, isObjectEmpty, keyGenerator } from "./utils/functions.js";
|
|
213
213
|
import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from "./utils/langs.js";
|
|
214
214
|
import { getFileIcon } from "./utils/mapper/getFileIcon.js";
|
|
215
215
|
import { equipmentTypesForPredefinedPropertiesMapper } from "./utils/mapper/equipmentTypesForPredefinedPropertiesMapper.js";
|
|
216
216
|
import { NotificationsUrlKeys, PREFIX_CONFIG_NOTIFICATION_WS, PREFIX_DIRECTORY_NOTIFICATION_WS, PREFIX_STUDY_NOTIFICATION_WS } from "./utils/constants/notificationsProvider.js";
|
|
217
217
|
import { DARK_THEME, LIGHT_THEME, makeComposeClasses, mergeSx, toNestedGlobalSelectors } from "./utils/styles.js";
|
|
218
|
+
import { CustomError, formatMessageValues } from "./utils/types/CustomError.js";
|
|
218
219
|
import { ElementType } from "./utils/types/elementType.js";
|
|
219
220
|
import { ALL_EQUIPMENTS, BASE_EQUIPMENTS, EquipmentType, ExtendedEquipmentType, HvdcType, OperatingStatus, SEARCH_EQUIPMENTS, TYPE_TAG_MAX_SIZE, VL_TAG_MAX_SIZE, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/types/equipmentType.js";
|
|
220
221
|
import { Battery, BusBar, DanglingLine, Generator, Hvdc, LCC, Line, Load, SVC, ShuntCompensator, Substation, ThreeWindingTransfo, TwoWindingTransfo, VSC, VoltageLevel } from "./utils/types/equipmentTypes.js";
|
|
@@ -225,6 +226,7 @@ import { ParameterType } from "./utils/types/parameters.type.js";
|
|
|
225
226
|
import { SolverTypeInfos } from "./utils/types/dynamic-simulation.type.js";
|
|
226
227
|
import { DistributionType, SensitivityType } from "./utils/types/sensitivity-analysis.type.js";
|
|
227
228
|
import { toNumber, validateValueIsANumber } from "./utils/validation-functions.js";
|
|
229
|
+
import { getEquipmentTypeShortLabel, getEquipmentTypeTagLabel } from "./utils/labelUtils.js";
|
|
228
230
|
import "./utils/yupConfig.js";
|
|
229
231
|
import { cardErrorBoundaryEn } from "./translations/en/cardErrorBoundaryEn.js";
|
|
230
232
|
import { businessErrorsEn } from "./translations/en/businessErrorsEn.js";
|
|
@@ -744,17 +746,19 @@ export {
|
|
|
744
746
|
flatParametersEn,
|
|
745
747
|
flatParametersFr,
|
|
746
748
|
formatComputingTypeLabel,
|
|
749
|
+
formatMessageValues,
|
|
747
750
|
genHelperError,
|
|
748
751
|
generateTreeViewFinderClass,
|
|
749
752
|
getAppName,
|
|
750
753
|
getAvailableComponentLibraries,
|
|
751
754
|
getComputedLanguage,
|
|
752
755
|
getDefaultLoadFlowProvider,
|
|
756
|
+
getEquipmentTypeShortLabel,
|
|
757
|
+
getEquipmentTypeTagLabel,
|
|
753
758
|
getEquipmentsInfosForSearchBar,
|
|
754
759
|
getExpertFilterEmptyFormData,
|
|
755
760
|
getExplicitNamingFilterEmptyFormData,
|
|
756
761
|
getFileIcon,
|
|
757
|
-
getFilterEquipmentTypeLabel,
|
|
758
762
|
getLimitReductionsFormSchema,
|
|
759
763
|
getLoadFlowDefaultLimitReductions,
|
|
760
764
|
getLoadFlowProviders,
|
|
@@ -836,6 +840,7 @@ export {
|
|
|
836
840
|
setStudyShortCircuitParameters,
|
|
837
841
|
setUnauthorizedUserInfo,
|
|
838
842
|
setUserValidationError,
|
|
843
|
+
snackWithFallback,
|
|
839
844
|
styles,
|
|
840
845
|
default2 as svg,
|
|
841
846
|
tableEn,
|
package/dist/services/index.d.ts
CHANGED
package/dist/services/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText,
|
|
1
|
+
import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList } from "./utils.js";
|
|
2
2
|
import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./explore.js";
|
|
3
3
|
import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./appsMetadata.js";
|
|
4
4
|
import { elementAlreadyExists, fetchConfigParameter, fetchConfigParameters, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, getAppName, updateConfigParameter } from "./directory.js";
|
|
@@ -9,16 +9,13 @@ import { fetchCurrentAnnouncement, fetchUserDetails } from "./userAdmin.js";
|
|
|
9
9
|
import { getVoltageInitParameters, getVoltageInitUrl } from "./voltage-init.js";
|
|
10
10
|
import { getPccMinStudyParameters, updatePccMinParameters } from "./pcc-min.js";
|
|
11
11
|
import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./security-analysis.js";
|
|
12
|
-
import { CustomError } from "./businessErrorCode.js";
|
|
13
12
|
export {
|
|
14
|
-
CustomError,
|
|
15
13
|
NetworkTimeoutError,
|
|
16
14
|
PREFIX_STUDY_QUERIES,
|
|
17
15
|
backendFetch,
|
|
18
16
|
backendFetchFile,
|
|
19
17
|
backendFetchJson,
|
|
20
18
|
backendFetchText,
|
|
21
|
-
catchErrorHandler,
|
|
22
19
|
createFilter,
|
|
23
20
|
createParameter,
|
|
24
21
|
elementAlreadyExists,
|
package/dist/services/utils.d.ts
CHANGED
|
@@ -18,5 +18,4 @@ export declare const backendFetchJson: (url: string, init?: FetchInitWithTimeout
|
|
|
18
18
|
export declare function backendFetchText(url: string, init?: FetchInitWithTimeout, token?: string): Promise<string>;
|
|
19
19
|
export declare const backendFetchFile: (url: string, init: RequestInit, token?: string) => Promise<Blob>;
|
|
20
20
|
export declare const getRequestParamFromList: (paramName: string, params?: string[]) => URLSearchParams;
|
|
21
|
-
export declare const catchErrorHandler: (error: unknown, callback: (message: string) => void) => void;
|
|
22
21
|
export {};
|
package/dist/services/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getUserToken } from "../redux/commonStore.js";
|
|
2
|
-
import { CustomError } from "
|
|
2
|
+
import { CustomError } from "../utils/types/CustomError.js";
|
|
3
3
|
const DEFAULT_TIMEOUT_MS = 5e4;
|
|
4
4
|
class NetworkTimeoutError extends Error {
|
|
5
5
|
constructor(messageKey = "errors.network.timeout") {
|
|
@@ -38,7 +38,12 @@ const handleError = (response) => {
|
|
|
38
38
|
const errorJson = parseError(text);
|
|
39
39
|
let customError;
|
|
40
40
|
if (errorJson?.businessErrorCode != null) {
|
|
41
|
-
throw new CustomError(
|
|
41
|
+
throw new CustomError(
|
|
42
|
+
errorJson.message,
|
|
43
|
+
errorJson.status,
|
|
44
|
+
errorJson.businessErrorCode,
|
|
45
|
+
errorJson.businessErrorValues
|
|
46
|
+
);
|
|
42
47
|
}
|
|
43
48
|
if (errorJson && errorJson.status && errorJson.error && errorJson.message) {
|
|
44
49
|
customError = new CustomError(
|
|
@@ -82,19 +87,11 @@ const backendFetchFile = (url, init, token) => {
|
|
|
82
87
|
const getRequestParamFromList = (paramName, params = []) => {
|
|
83
88
|
return new URLSearchParams(params.map((param) => [paramName, param]));
|
|
84
89
|
};
|
|
85
|
-
const catchErrorHandler = (error, callback) => {
|
|
86
|
-
if (error instanceof Object && "message" in error && typeof error.message === "string") {
|
|
87
|
-
callback(error.message);
|
|
88
|
-
} else {
|
|
89
|
-
callback("unknown error");
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
90
|
export {
|
|
93
91
|
NetworkTimeoutError,
|
|
94
92
|
backendFetch,
|
|
95
93
|
backendFetchFile,
|
|
96
94
|
backendFetchJson,
|
|
97
95
|
backendFetchText,
|
|
98
|
-
catchErrorHandler,
|
|
99
96
|
getRequestParamFromList
|
|
100
97
|
};
|
|
@@ -15,6 +15,24 @@ export declare const businessErrorsEn: {
|
|
|
15
15
|
'explore.permissionDenied': string;
|
|
16
16
|
'explore.maxElementsExceeded': string;
|
|
17
17
|
'explore.incorrectCaseFile': string;
|
|
18
|
+
'study.notFound': string;
|
|
19
|
+
'study.computationRunning': string;
|
|
20
|
+
'study.loadflowError': string;
|
|
21
|
+
'study.notAllowed': string;
|
|
22
|
+
'study.cantDeleteRootNode': string;
|
|
23
|
+
'study.moveNetworkModificationForbidden': string;
|
|
24
|
+
'study.badNodeType': string;
|
|
25
|
+
'study.nodeNotBuilt': string;
|
|
26
|
+
'study.nodeNameAlreadyExist': string;
|
|
27
|
+
'study.timeSeriesBadType': string;
|
|
28
|
+
'study.noVoltageInitResultsForNode': string;
|
|
29
|
+
'study.maxNodeBuildsExceeded': string;
|
|
30
|
+
'study.rootNetworkDeleteForbidden': string;
|
|
31
|
+
'study.maximumRootNetworkByStudyReached': string;
|
|
32
|
+
'study.maximumTagLengthExceeded': string;
|
|
33
|
+
'study.networkExportFailed': string;
|
|
34
|
+
'study.tooManyNadConfigs': string;
|
|
35
|
+
'study.tooManyMapCards': string;
|
|
18
36
|
'useradmin.permissionDenied': string;
|
|
19
37
|
'useradmin.userNotFound': string;
|
|
20
38
|
'useradmin.userAlreadyExists': string;
|
|
@@ -9,6 +9,24 @@ const businessErrorsEn = {
|
|
|
9
9
|
"explore.permissionDenied": "You are not allowed to perform this action.",
|
|
10
10
|
"explore.maxElementsExceeded": "The number of allowed elements has been exceeded.",
|
|
11
11
|
"explore.incorrectCaseFile": "The provided case file is incorrect.",
|
|
12
|
+
"study.notFound": "Study was not found.",
|
|
13
|
+
"study.computationRunning": "The operation cannot be performed because a computation is running.",
|
|
14
|
+
"study.loadflowError": "Loadflow error.",
|
|
15
|
+
"study.notAllowed": "Operation not allowed.",
|
|
16
|
+
"study.cantDeleteRootNode": "A root node cannot be deleted.",
|
|
17
|
+
"study.moveNetworkModificationForbidden": "Impossible to move this network modification.",
|
|
18
|
+
"study.badNodeType": "Bad node type.",
|
|
19
|
+
"study.nodeNotBuilt": "Node not built.",
|
|
20
|
+
"study.nodeNameAlreadyExist": "Node name already exists.",
|
|
21
|
+
"study.timeSeriesBadType": "Bad timeseries type.",
|
|
22
|
+
"study.noVoltageInitResultsForNode": "No voltage initialization results found.",
|
|
23
|
+
"study.maxNodeBuildsExceeded": "Maximum number of built nodes exceeded.",
|
|
24
|
+
"study.rootNetworkDeleteForbidden": "Impossible to delete this root network.",
|
|
25
|
+
"study.maximumRootNetworkByStudyReached": "Maximum number of root network per study exceeded.",
|
|
26
|
+
"study.maximumTagLengthExceeded": "Tag length exceeded.",
|
|
27
|
+
"study.networkExportFailed": "Failed to export network.",
|
|
28
|
+
"study.tooManyNadConfigs": "Maximum number of NAD configuration exceeded.",
|
|
29
|
+
"study.tooManyMapCards": "Maximum number of cards exceeded.",
|
|
12
30
|
"useradmin.permissionDenied": "You don't have permission to perform this action.",
|
|
13
31
|
"useradmin.userNotFound": "User not found.",
|
|
14
32
|
"useradmin.userAlreadyExists": "User already exists.",
|
|
@@ -18,7 +36,7 @@ const businessErrorsEn = {
|
|
|
18
36
|
"useradmin.groupAlreadyExists": "User group already exists.",
|
|
19
37
|
"useradmin.announcementInvalidPeriod": "The announcement has an invalid time period.",
|
|
20
38
|
"useradmin.announcementOverlap": "The announcement period overlaps with an existing one.",
|
|
21
|
-
"filter.filterCycleDetected": "Filter cycle detected
|
|
39
|
+
"filter.filterCycleDetected": "Filter cycle detected: {filters}"
|
|
22
40
|
};
|
|
23
41
|
export {
|
|
24
42
|
businessErrorsEn
|
|
@@ -11,11 +11,11 @@ const equipmentShortEn = {
|
|
|
11
11
|
"equipment_short/svc": "Static var compensators",
|
|
12
12
|
"equipment_short/hvdcLine": "HVDC",
|
|
13
13
|
"equipment_short/hvdcStation": "HVDC stations",
|
|
14
|
-
"equipment_short/vscConverterStation": "VSC",
|
|
15
|
-
"equipment_short/lccConverterStation": "LCC",
|
|
14
|
+
"equipment_short/vscConverterStation": "VSC stations",
|
|
15
|
+
"equipment_short/lccConverterStation": "LCC stations",
|
|
16
16
|
"equipment_short/busbarSection": "BBS",
|
|
17
17
|
"equipment_short/bus": "Bus",
|
|
18
|
-
"equipment_short/switch": "
|
|
18
|
+
"equipment_short/switch": "Switches",
|
|
19
19
|
"equipment_short/danglingLine": "Dangling lines",
|
|
20
20
|
"equipment_short/hvdcLineLcc": "HVDC LCC",
|
|
21
21
|
"equipment_short/hvdcLineVsc": "HVDC VSC"
|
|
@@ -15,6 +15,24 @@ export declare const businessErrorsFr: {
|
|
|
15
15
|
'explore.permissionDenied': string;
|
|
16
16
|
'explore.maxElementsExceeded': string;
|
|
17
17
|
'explore.incorrectCaseFile': string;
|
|
18
|
+
'study.notFound': string;
|
|
19
|
+
'study.computationRunning': string;
|
|
20
|
+
'study.loadflowError': string;
|
|
21
|
+
'study.notAllowed': string;
|
|
22
|
+
'study.cantDeleteRootNode': string;
|
|
23
|
+
'study.moveNetworkModificationForbidden': string;
|
|
24
|
+
'study.badNodeType': string;
|
|
25
|
+
'study.nodeNotBuilt': string;
|
|
26
|
+
'study.nodeNameAlreadyExist': string;
|
|
27
|
+
'study.timeSeriesBadType': string;
|
|
28
|
+
'study.noVoltageInitResultsForNode': string;
|
|
29
|
+
'study.maxNodeBuildsExceeded': string;
|
|
30
|
+
'study.rootNetworkDeleteForbidden': string;
|
|
31
|
+
'study.maximumRootNetworkByStudyReached': string;
|
|
32
|
+
'study.maximumTagLengthExceeded': string;
|
|
33
|
+
'study.networkExportFailed': string;
|
|
34
|
+
'study.tooManyNadConfigs': string;
|
|
35
|
+
'study.tooManyMapCards': string;
|
|
18
36
|
'useradmin.permissionDenied': string;
|
|
19
37
|
'useradmin.userNotFound': string;
|
|
20
38
|
'useradmin.userAlreadyExists': string;
|
|
@@ -9,6 +9,24 @@ const businessErrorsFr = {
|
|
|
9
9
|
"explore.permissionDenied": "Vous n'êtes pas autorisé à effectuer cette action.",
|
|
10
10
|
"explore.maxElementsExceeded": "Le nombre d'éléments autorisés a été dépassé.",
|
|
11
11
|
"explore.incorrectCaseFile": "Le fichier réseau fourni est incorrect.",
|
|
12
|
+
"study.notFound": "Étude non trouvée.",
|
|
13
|
+
"study.computationRunning": "L'opération ne peut être menée car un calcul est en cours.",
|
|
14
|
+
"study.loadflowError": "Erreur de calcul de répartition.",
|
|
15
|
+
"study.notAllowed": "Opération non permise.",
|
|
16
|
+
"study.cantDeleteRootNode": "Un noeud racine ne peut être supprimé.",
|
|
17
|
+
"study.moveNetworkModificationForbidden": "Impossible de déplacer cette modification de réseau.",
|
|
18
|
+
"study.badNodeType": "Mauvais type de noeud.",
|
|
19
|
+
"study.nodeNotBuilt": "Noeud non réalisé.",
|
|
20
|
+
"study.nodeNameAlreadyExist": "Ce nom de noeud existe déjà.",
|
|
21
|
+
"study.timeSeriesBadType": "Série temporelle de mauvais type.",
|
|
22
|
+
"study.noVoltageInitResultsForNode": "Pas de résultats pour l'initialisation du plan de tension.",
|
|
23
|
+
"study.maxNodeBuildsExceeded": "Nombre maximal de noeuds réalisés atteint.",
|
|
24
|
+
"study.rootNetworkDeleteForbidden": "Impossible de supprimer ce réseau racine.",
|
|
25
|
+
"study.maximumRootNetworkByStudyReached": "Nombre maximal de réseau racine par étude atteint.",
|
|
26
|
+
"study.maximumTagLengthExceeded": "Taille maximale d'étiquette atteinte.",
|
|
27
|
+
"study.networkExportFailed": "Échec de l'export de réseau.",
|
|
28
|
+
"study.tooManyNadConfigs": "Nombre maximal de configurations d'image nodale de zone atteint.",
|
|
29
|
+
"study.tooManyMapCards": "Nombre maximal de carte atteint.",
|
|
12
30
|
"useradmin.permissionDenied": "Vous n'avez pas la permission d'effectuer cette action.",
|
|
13
31
|
"useradmin.userNotFound": "Utilisateur introuvable.",
|
|
14
32
|
"useradmin.userAlreadyExists": "L'utilisateur existe déjà.",
|
|
@@ -18,7 +36,7 @@ const businessErrorsFr = {
|
|
|
18
36
|
"useradmin.groupAlreadyExists": "Le groupe d'utilisateurs existe déjà.",
|
|
19
37
|
"useradmin.announcementInvalidPeriod": "La période de l'annonce est invalide.",
|
|
20
38
|
"useradmin.announcementOverlap": "La période de l'annonce chevauche une autre annonce existante.",
|
|
21
|
-
"filter.filterCycleDetected": "Cycle de filtre détect
|
|
39
|
+
"filter.filterCycleDetected": "Cycle de filtre détecté: {filters}"
|
|
22
40
|
};
|
|
23
41
|
export {
|
|
24
42
|
businessErrorsFr
|
|
@@ -11,11 +11,11 @@ const equipmentShortFr = {
|
|
|
11
11
|
"equipment_short/svc": "CSPR",
|
|
12
12
|
"equipment_short/hvdcLine": "HVDC",
|
|
13
13
|
"equipment_short/hvdcStation": "Stations HVDC",
|
|
14
|
-
"equipment_short/vscConverterStation": "VSC",
|
|
15
|
-
"equipment_short/lccConverterStation": "LCC",
|
|
14
|
+
"equipment_short/vscConverterStation": "Stations VSC",
|
|
15
|
+
"equipment_short/lccConverterStation": "Stations LCC",
|
|
16
16
|
"equipment_short/busbarSection": "SJB",
|
|
17
17
|
"equipment_short/bus": "Noeud",
|
|
18
|
-
"equipment_short/switch": "
|
|
18
|
+
"equipment_short/switch": "OC",
|
|
19
19
|
"equipment_short/danglingLine": "Frontières",
|
|
20
20
|
"equipment_short/hvdcLineLcc": "HVDC LCC",
|
|
21
21
|
"equipment_short/hvdcLineVsc": "HVDC VSC"
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SnackInputs, UseSnackMessageReturn } from '../hooks/useSnackMessage';
|
|
2
|
+
export type HeaderSnackInputs = Pick<SnackInputs, 'headerId' | 'headerTxt' | 'headerValues'>;
|
|
3
|
+
export declare function catchErrorHandler(error: unknown, callback: (message: string) => void): void;
|
|
4
|
+
export declare function snackWithFallback(snackError: UseSnackMessageReturn['snackError'], error: unknown, headerInputs?: HeaderSnackInputs): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CustomError, formatMessageValues } from "./types/CustomError.js";
|
|
2
|
+
function catchErrorHandler(error, callback) {
|
|
3
|
+
if (error instanceof Object && "message" in error && typeof error.message === "string") {
|
|
4
|
+
callback(error.message);
|
|
5
|
+
} else {
|
|
6
|
+
callback("unknown error");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function snackWithFallback(snackError, error, headerInputs) {
|
|
10
|
+
if (error instanceof CustomError && error.businessErrorCode) {
|
|
11
|
+
snackError({
|
|
12
|
+
messageId: error.businessErrorCode,
|
|
13
|
+
messageValues: error.businessErrorValues ? formatMessageValues(error.businessErrorValues) : void 0,
|
|
14
|
+
...headerInputs
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
catchErrorHandler(error, (message) => {
|
|
18
|
+
snackError({
|
|
19
|
+
messageTxt: message,
|
|
20
|
+
...headerInputs
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
catchErrorHandler,
|
|
27
|
+
snackWithFallback
|
|
28
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export * from './algos';
|
|
8
8
|
export * from './constants';
|
|
9
9
|
export * from './conversionUtils';
|
|
10
|
+
export * from './error';
|
|
10
11
|
export * from './functions';
|
|
11
12
|
export * from './langs';
|
|
12
13
|
export * from './mapper';
|
|
@@ -14,4 +15,5 @@ export * from './constants/notificationsProvider';
|
|
|
14
15
|
export * from './styles';
|
|
15
16
|
export * from './types';
|
|
16
17
|
export * from './validation-functions';
|
|
18
|
+
export * from './labelUtils';
|
|
17
19
|
export { default as yupConfig } from './yupConfig';
|