@autofleet/network 1.3.3 → 1.3.5
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.
- package/index.js +6 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -97,17 +97,20 @@ module.exports = class Network {
|
|
|
97
97
|
logger.info(`Finish Request: [${response.config.method.toUpperCase()} ${response.config.url}`);
|
|
98
98
|
return response;
|
|
99
99
|
}, (error) => {
|
|
100
|
-
if(error.request._currentRequest.reusedSocket && error.code === 'ECONNRESET') {
|
|
100
|
+
if((error.request && error.request._currentRequest.reusedSocket && error.code === 'ECONNRESET') {
|
|
101
101
|
// See https://www.npmjs.com/package/agentkeepalive
|
|
102
102
|
// Support req.reusedSocket
|
|
103
103
|
// https://code-examples.net/en/q/28a8069
|
|
104
104
|
logger.warn('ECONNRESET issue, will retry', {
|
|
105
105
|
req: error.request._currentRequest._currentUrl,
|
|
106
|
-
method: error.request._currentRequest._options.method,
|
|
106
|
+
// method: error.request._currentRequest._options.method,
|
|
107
107
|
})
|
|
108
108
|
return axios.request(error.config);
|
|
109
109
|
}
|
|
110
|
-
logger.error('Finish Request with error', {
|
|
110
|
+
logger.error('Finish Request with error', {
|
|
111
|
+
status: error.status,
|
|
112
|
+
data: error.response && error.response.data
|
|
113
|
+
});
|
|
111
114
|
throw error;
|
|
112
115
|
});
|
|
113
116
|
}
|