playov2-js-utilities 0.3.46 → 0.3.48
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.
|
@@ -35,17 +35,17 @@ const responseHandler = (resp, requestId) => {
|
|
|
35
35
|
|
|
36
36
|
const { status, data, config = { url: '' } } = resp;
|
|
37
37
|
const { url = '' } = config;
|
|
38
|
-
if (status
|
|
39
|
-
const { requestStatus } = data;
|
|
38
|
+
if (status >= 200 && status < 400) {
|
|
39
|
+
const { requestStatus, message = 'success' } = data;
|
|
40
40
|
if (!requestStatus && requestStatus != 0) { //if the service does not provide request status
|
|
41
41
|
data["requestStatus"] = 1;
|
|
42
42
|
}
|
|
43
|
-
Logger.prepareInfoLog(requestId, data, `Api call to url to ${url} succeeded with status ${status}`)
|
|
43
|
+
Logger.prepareInfoLog(requestId, { status, requestStatus: data.requestStatus, message }, `Api call to url to ${url} succeeded with status ${status}`)
|
|
44
44
|
return data
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
else { // ideally this should not get triggered unless there is fault in calling lib itself
|
|
48
|
-
Logger.prepareErrorLog(requestId,
|
|
48
|
+
Logger.prepareErrorLog(requestId, { response: resp }, "axios error");
|
|
49
49
|
throw ({ requestStatus: 0, message: "Failed to handle response" })
|
|
50
50
|
}
|
|
51
51
|
}
|