ismx-nexo-node-app 0.4.79 → 0.4.80
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.
|
@@ -40,6 +40,7 @@ const QueryUtils_1 = __importDefault(require("../repository/utils/QueryUtils"));
|
|
|
40
40
|
class BusinessProxy {
|
|
41
41
|
constructor() {
|
|
42
42
|
this.modules = {};
|
|
43
|
+
this.onError = (error) => error;
|
|
43
44
|
}
|
|
44
45
|
setModules(modules) {
|
|
45
46
|
this.modules = modules;
|
|
@@ -66,7 +67,7 @@ class BusinessProxy {
|
|
|
66
67
|
body = JSON.stringify(request.body);
|
|
67
68
|
}
|
|
68
69
|
// Realiza la llamada a la API con las cabeceras y la URL base de la llamada.
|
|
69
|
-
return (0, node_fetch_1.default)(module.host + endpoint + QueryUtils_1.default.map(request.query), Object.assign(Object.assign({}, request), { method, body: method !== "GET" ? body : undefined, headers })).catch((error) => {
|
|
70
|
+
return (0, node_fetch_1.default)(module.host + endpoint + QueryUtils_1.default.map(request.query), Object.assign(Object.assign({}, request), { method, body: method !== "GET" ? body : undefined, headers })).catch((error) => { throw this.onError(error); });
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ export interface Module {
|
|
|
12
12
|
export default class BusinessProxy
|
|
13
13
|
{
|
|
14
14
|
private modules: {[key:string]: Module} = {};
|
|
15
|
-
private onError
|
|
15
|
+
private onError: (error: Error) => Error = (error) => error;
|
|
16
16
|
|
|
17
17
|
setModules(modules: {[key:string]: Module}) {
|
|
18
18
|
this.modules = modules
|
|
@@ -43,6 +43,6 @@ export default class BusinessProxy
|
|
|
43
43
|
// Realiza la llamada a la API con las cabeceras y la URL base de la llamada.
|
|
44
44
|
return fetch(module.host + endpoint + QueryUtils.map(request.query), {
|
|
45
45
|
...request, method, body: method !== "GET" ? body : undefined, headers
|
|
46
|
-
}).catch((error) => this.onError
|
|
46
|
+
}).catch((error) => { throw this.onError(error) });
|
|
47
47
|
}
|
|
48
48
|
}
|