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

Sign up to get free protection for your applications and to get access to all the features.
@@ -188,16 +188,30 @@ const TaxonomyForm = ({ url }) => {
188
188
  }
189
189
  }
190
190
  catch (error) {
191
- // Extract additional details if available
191
+ // Extract the main error message
192
192
  const errorMessage = error.message || "An unknown error occurred";
193
- const innerException = error.innerException || ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || error.details || "";
194
- // Combine the main message with additional details
195
- const detailedMessage = innerException
196
- ? `${errorMessage}\n\nDetails: ${JSON.stringify(innerException, null, 2)}`
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}`
197
210
  : errorMessage;
198
- // Display the detailed error message in an alert
211
+ // Display the error details
199
212
  alert("Error while adding SubType: " + detailedMessage);
200
- console.error("Error details:", error); // Log full error for debugging
213
+ // Log full error object for debugging
214
+ console.error("Error object:", error);
201
215
  }
202
216
  setIsModalOpen(false);
203
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.35",
3
+ "version": "21.0.36",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -249,24 +249,33 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
249
249
  setAllTaxonomies(fetchedTaxonomies);
250
250
  }
251
251
  } catch (error: any) {
252
- // Extract additional details if available
252
+ // Extract the main error message
253
253
  const errorMessage = error.message || "An unknown error occurred";
254
- const innerException =
255
- error.innerException || error.response?.data || error.details || "";
256
-
257
- // Combine the main message with additional details
258
- const detailedMessage = innerException
259
- ? `${errorMessage}\n\nDetails: ${JSON.stringify(
260
- innerException,
261
- null,
262
- 2
263
- )}`
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}`
264
272
  : errorMessage;
265
273
 
266
- // Display the detailed error message in an alert
274
+ // Display the error details
267
275
  alert("Error while adding SubType: " + detailedMessage);
268
276
 
269
- console.error("Error details:", error); // Log full error for debugging
277
+ // Log full error object for debugging
278
+ console.error("Error object:", error);
270
279
  }
271
280
 
272
281
  setIsModalOpen(false);