eleven-solutions-common-website-unique-web 21.0.34 → 21.0.36

Sign up to get free protection for your applications and to get access to all the features.
@@ -168,6 +168,7 @@ const TaxonomyForm = ({ url }) => {
168
168
  setIsAddingSubType(true);
169
169
  };
170
170
  const handleSubTypeSubmitClick = () => __awaiter(void 0, void 0, void 0, function* () {
171
+ var _a;
171
172
  if (!subCode || !subValue) {
172
173
  alert("Please fill out both Code and Value fields before proceeding.");
173
174
  return;
@@ -187,8 +188,30 @@ const TaxonomyForm = ({ url }) => {
187
188
  }
188
189
  }
189
190
  catch (error) {
190
- console.error(`Error ${editTaxonomyItem ? "editing" : "adding"} SubType:`, error);
191
- alert("Error while adding SubType: " + error.response.data.message);
191
+ // Extract the main error message
192
+ const errorMessage = error.message || "An unknown error occurred";
193
+ // Extract the inner exception details, if available
194
+ let innerExceptionDetails = "";
195
+ if (error.innerException) {
196
+ // If the error has an `innerException` property
197
+ innerExceptionDetails = JSON.stringify(error.innerException, null, 2);
198
+ }
199
+ else if ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) {
200
+ // If using Axios or similar libraries, look for response data
201
+ innerExceptionDetails = JSON.stringify(error.response.data, null, 2);
202
+ }
203
+ else if (error.details) {
204
+ // Look for a generic `details` property
205
+ innerExceptionDetails = JSON.stringify(error.details, null, 2);
206
+ }
207
+ // Format the final error message
208
+ const detailedMessage = innerExceptionDetails
209
+ ? `${errorMessage}\n\nInner Exception Details:\n${innerExceptionDetails}`
210
+ : errorMessage;
211
+ // Display the error details
212
+ alert("Error while adding SubType: " + detailedMessage);
213
+ // Log full error object for debugging
214
+ console.error("Error object:", error);
192
215
  }
193
216
  setIsModalOpen(false);
194
217
  setSubCode("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "21.0.34",
3
+ "version": "21.0.36",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -248,12 +248,34 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
248
248
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
249
249
  setAllTaxonomies(fetchedTaxonomies);
250
250
  }
251
- } catch (error) {
252
- console.error(
253
- `Error ${editTaxonomyItem ? "editing" : "adding"} SubType:`,
254
- error
255
- );
256
- alert("Error while adding SubType: " + error.response.data.message);
251
+ } catch (error: any) {
252
+ // Extract the main error message
253
+ const errorMessage = error.message || "An unknown error occurred";
254
+
255
+ // Extract the inner exception details, if available
256
+ let innerExceptionDetails = "";
257
+
258
+ if (error.innerException) {
259
+ // If the error has an `innerException` property
260
+ innerExceptionDetails = JSON.stringify(error.innerException, null, 2);
261
+ } else if (error.response?.data) {
262
+ // If using Axios or similar libraries, look for response data
263
+ innerExceptionDetails = JSON.stringify(error.response.data, null, 2);
264
+ } else if (error.details) {
265
+ // Look for a generic `details` property
266
+ innerExceptionDetails = JSON.stringify(error.details, null, 2);
267
+ }
268
+
269
+ // Format the final error message
270
+ const detailedMessage = innerExceptionDetails
271
+ ? `${errorMessage}\n\nInner Exception Details:\n${innerExceptionDetails}`
272
+ : errorMessage;
273
+
274
+ // Display the error details
275
+ alert("Error while adding SubType: " + detailedMessage);
276
+
277
+ // Log full error object for debugging
278
+ console.error("Error object:", error);
257
279
  }
258
280
 
259
281
  setIsModalOpen(false);