ismx-nexo-node-app 0.3.69 → 0.3.70
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.
|
@@ -37,7 +37,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
const Service_1 = require("../api/Service");
|
|
39
39
|
const Business_1 = __importDefault(require("./Business"));
|
|
40
|
-
const BusinessErrors_1 = require("../business/BusinessErrors");
|
|
41
40
|
class BusinessServer extends Business_1.default {
|
|
42
41
|
constructor() {
|
|
43
42
|
super();
|
|
@@ -101,7 +100,7 @@ class BusinessServer extends Business_1.default {
|
|
|
101
100
|
}
|
|
102
101
|
run(service) {
|
|
103
102
|
return (request, socket) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
103
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
105
104
|
let code;
|
|
106
105
|
let response = Service_1.HttpResponse.ko(500, "Internal server error");
|
|
107
106
|
// Asigna un valor único a la llamada de la API.
|
|
@@ -129,16 +128,14 @@ class BusinessServer extends Business_1.default {
|
|
|
129
128
|
catch (e) { }
|
|
130
129
|
if (error instanceof Service_1.HttpResponse)
|
|
131
130
|
response = error;
|
|
132
|
-
if (error instanceof BusinessErrors_1.FormalError)
|
|
133
|
-
response = error.type;
|
|
134
131
|
else
|
|
135
|
-
response = Service_1.HttpResponse.ko(
|
|
132
|
+
response = Service_1.HttpResponse.ko(500, null);
|
|
136
133
|
}
|
|
137
134
|
finally {
|
|
138
|
-
let status = (
|
|
135
|
+
let status = (_g = response === null || response === void 0 ? void 0 : response.httpCode) !== null && _g !== void 0 ? _g : 500;
|
|
139
136
|
socket.status(status).send(response === null || response === void 0 ? void 0 : response.content);
|
|
140
137
|
try {
|
|
141
|
-
(
|
|
138
|
+
(_h = this.onEnd) === null || _h === void 0 ? void 0 : _h.call(this, request, response);
|
|
142
139
|
}
|
|
143
140
|
catch (e) { }
|
|
144
141
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Service, {HttpRequest, HttpResponse} from "../api/Service";
|
|
2
2
|
import Business from "./Business";
|
|
3
|
-
import {FormalError} from "../business/BusinessErrors";
|
|
4
3
|
|
|
5
4
|
export default class BusinessServer extends Business
|
|
6
5
|
{
|
|
@@ -90,8 +89,7 @@ export default class BusinessServer extends Business
|
|
|
90
89
|
} catch (error: any) {
|
|
91
90
|
try { error = this.onError?.(request, error); } catch (e) { }
|
|
92
91
|
if (error instanceof HttpResponse) response = error;
|
|
93
|
-
|
|
94
|
-
else response = HttpResponse.ko(error.httpCode ?? 500, error.content);
|
|
92
|
+
else response = HttpResponse.ko(500, null);
|
|
95
93
|
|
|
96
94
|
} finally {
|
|
97
95
|
let status = response?.httpCode ?? 500;
|