drapcode-utility 2.6.1 → 2.6.2

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.
@@ -163,6 +163,14 @@ const callCurlRequest = async (setting, user = {}, tenant = {}, userSetting = {}
163
163
  return prepareReturnObject(errorMessage);
164
164
  }
165
165
  drapcode_logger_1.logger.info(`result.status: ${result?.status}`, { label: projectId });
166
+ if (!result?.data) {
167
+ // In some cases when axios throws error with status 4xx the actual error message is in response.data
168
+ const errResponse = result?.response;
169
+ const errData = errResponse?.data;
170
+ if (errData && Object.keys(errData).length > 0) {
171
+ result.data = errData;
172
+ }
173
+ }
166
174
  deleteLocalFiles(isMultipart, toDeleteFiles);
167
175
  return prepareReturnObject(result.data, result.status, true, result?.headers);
168
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drapcode-utility",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "DrapCode Utility",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",