fiscalia_bo-nest-helpers 0.2.19 → 0.2.20
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.
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.FilterHttpServiceResponse = exports.TransformHttpServiceResponse = void 0;
|
4
4
|
const rxjs_1 = require("rxjs");
|
5
|
+
const chalk_1 = require("chalk");
|
5
6
|
const axiosResponseStatusMessages = {
|
6
7
|
100: 'Continuar',
|
7
8
|
101: 'Cambiando Protocolos',
|
@@ -86,6 +87,13 @@ exports.TransformHttpServiceResponse = (0, rxjs_1.map)((resp) => {
|
|
86
87
|
}
|
87
88
|
return response;
|
88
89
|
});
|
90
|
+
const printError = (config, str) => {
|
91
|
+
if (config) {
|
92
|
+
const { timeout, baseURL, url, method, data } = config;
|
93
|
+
console.info(chalk_1.bold.red(str, `${baseURL}${url}`));
|
94
|
+
console.info({ timeout, baseURL, url, method, data });
|
95
|
+
}
|
96
|
+
};
|
89
97
|
exports.FilterHttpServiceResponse = (0, rxjs_1.catchError)((error) => {
|
90
98
|
let resp = {
|
91
99
|
error: true,
|
@@ -96,13 +104,16 @@ exports.FilterHttpServiceResponse = (0, rxjs_1.catchError)((error) => {
|
|
96
104
|
if (error.isAxiosError) {
|
97
105
|
if (error.code === 'ECONNREFUSED') {
|
98
106
|
const err = error;
|
99
|
-
resp.message = `Error: no se pudo connecter al HOST [http(s)://${err.address}
|
107
|
+
resp.message = `Error: no se pudo connecter al HOST [http(s)://${err.address}${err.request._options.path}]`;
|
108
|
+
console.info(chalk_1.bold.red(`ECONNREFUSED: http(s)://${err.address}${err.request._options.path}`));
|
100
109
|
}
|
101
110
|
else if (error.code === 'ENOTFOUND') {
|
102
|
-
resp.message = `Error: no se pudo connecter al servicio ${error.config.baseURL}
|
111
|
+
resp.message = `Error: no se pudo connecter al servicio ${error.config.baseURL}${error.config.url}`;
|
112
|
+
printError(error === null || error === void 0 ? void 0 : error.config, 'ENOTFOUND: ');
|
103
113
|
}
|
104
114
|
else if (error.code === 'ECONNABORTED') {
|
105
|
-
resp.message = `Error: tiempo limite de espera excedido ${error.config.baseURL}
|
115
|
+
resp.message = `Error: tiempo limite de espera excedido ${error.config.baseURL}${error.config.url}`;
|
116
|
+
printError(error === null || error === void 0 ? void 0 : error.config, 'ECONNABORTED: ');
|
106
117
|
}
|
107
118
|
else if (error.response) {
|
108
119
|
const respData = error.response.data;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"http-service.pipes.js","sourceRoot":"","sources":["../../src/http-service/http-service.pipes.ts"],"names":[],"mappings":";;;AACA,+BAA4D;
|
1
|
+
{"version":3,"file":"http-service.pipes.js","sourceRoot":"","sources":["../../src/http-service/http-service.pipes.ts"],"names":[],"mappings":";;;AACA,+BAA4D;AAE5D,iCAA6B;AAE7B,MAAM,2BAA2B,GAAG;IAClC,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,oBAAoB;IACzB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,6BAA6B;IAClC,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,mBAAmB;IACxB,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,wBAAwB;IAC7B,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,wBAAwB;IAC7B,GAAG,EAAE,sBAAsB;IAC3B,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,gBAAgB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