playov2-js-utilities 0.3.55 → 0.3.56

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.
@@ -21,7 +21,7 @@ const Logger = require('../logger.js');
21
21
  * @returns
22
22
  */
23
23
  const playoResponseHandler = (resp, requestId) => {
24
- if (resp.isAxiosError) {
24
+ if (resp.isAxiosError || resp.status >= 400) {
25
25
  //if axios error is triggered then axios throws HTTP code for timeout or other forms of unsuccessful errors
26
26
  const {
27
27
  code = "UNCAUGHT_ERROR",
@@ -30,7 +30,7 @@ const playoResponseHandler = (resp, requestId) => {
30
30
  response = { data: { requestStatus: 0 } }
31
31
  } = resp;
32
32
  const { url } = config;
33
- const { data = { requestStatus: 0, statusError: "POTENTIAL-BAD-GATEWAY" }} = response;
33
+ const { data = { requestStatus: 0, statusError: "POTENTIAL-BAD-GATEWAY" } } = response;
34
34
  data["message"] = message;
35
35
  Logger.prepareErrorLog(requestId, { code, message }, `Api call to url to ${url} failed`)
36
36
  throw (data);
@@ -38,6 +38,7 @@ const playoResponseHandler = (resp, requestId) => {
38
38
 
39
39
  const { status, data, config = { url: '' } } = resp;
40
40
  const { url = '' } = config;
41
+
41
42
  if (status >= 200 && status < 400) {
42
43
  const { requestStatus, message = 'success' } = data;
43
44
  if (!requestStatus && requestStatus != 0) { //if the service does not provide request status
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playov2-js-utilities",
3
- "version": "0.3.55",
3
+ "version": "0.3.56",
4
4
  "description": "Private package for JS utility functions",
5
5
  "main": "index.js",
6
6
  "scripts": {