@bool-ts/core 1.2.3 → 1.2.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/dist/hooks/factory.js +10 -8
- package/package.json +1 -1
- package/src/hooks/factory.ts +14 -10
package/dist/hooks/factory.js
CHANGED
|
@@ -124,14 +124,6 @@ const BoolFactory = (target, options) => {
|
|
|
124
124
|
}
|
|
125
125
|
next();
|
|
126
126
|
},
|
|
127
|
-
// Error catcher
|
|
128
|
-
(err, req, res, next) => {
|
|
129
|
-
(0, http_1.errorInfer)(res, err);
|
|
130
|
-
if (!options?.debug) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
console.error("Headers:", JSON.stringify(req.headers), "\nBody:", JSON.stringify(req.body), "\nError:", JSON.stringify(err));
|
|
134
|
-
},
|
|
135
127
|
// Response time log
|
|
136
128
|
ResponseTime.default((req, res, time) => {
|
|
137
129
|
const requestMethod = req.method.toUpperCase();
|
|
@@ -169,6 +161,16 @@ const BoolFactory = (target, options) => {
|
|
|
169
161
|
app.use(routers) : app.use(!metadata.prefix.startsWith("/") ?
|
|
170
162
|
`/${metadata.prefix}` : metadata.prefix, routers);
|
|
171
163
|
}
|
|
164
|
+
// Register error catcher
|
|
165
|
+
app.use(
|
|
166
|
+
// Error catcher
|
|
167
|
+
(err, req, res, next) => {
|
|
168
|
+
(0, http_1.errorInfer)(res, err);
|
|
169
|
+
if (!options?.debug) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
console.error("Headers:", JSON.stringify(req.headers), "\nBody:", JSON.stringify(req.body), "\nError:", JSON.stringify(err));
|
|
173
|
+
});
|
|
172
174
|
return app;
|
|
173
175
|
};
|
|
174
176
|
exports.BoolFactory = BoolFactory;
|
package/package.json
CHANGED
package/src/hooks/factory.ts
CHANGED
|
@@ -137,16 +137,6 @@ export const BoolFactory = (
|
|
|
137
137
|
|
|
138
138
|
next();
|
|
139
139
|
},
|
|
140
|
-
// Error catcher
|
|
141
|
-
(err: Errback, req: Request, res: Response, next: NextFunction) => {
|
|
142
|
-
errorInfer(res, err);
|
|
143
|
-
|
|
144
|
-
if (!options?.debug) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
console.error("Headers:", JSON.stringify(req.headers), "\nBody:", JSON.stringify(req.body), "\nError:", JSON.stringify(err));
|
|
149
|
-
},
|
|
150
140
|
// Response time log
|
|
151
141
|
ResponseTime.default((req: Request, res: Response, time: number) => {
|
|
152
142
|
const requestMethod = req.method.toUpperCase();
|
|
@@ -193,6 +183,20 @@ export const BoolFactory = (
|
|
|
193
183
|
`/${metadata.prefix}` : metadata.prefix, routers);
|
|
194
184
|
}
|
|
195
185
|
|
|
186
|
+
// Register error catcher
|
|
187
|
+
app.use(
|
|
188
|
+
// Error catcher
|
|
189
|
+
(err: Errback, req: Request, res: Response, next: NextFunction) => {
|
|
190
|
+
errorInfer(res, err);
|
|
191
|
+
|
|
192
|
+
if (!options?.debug) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
console.error("Headers:", JSON.stringify(req.headers), "\nBody:", JSON.stringify(req.body), "\nError:", JSON.stringify(err));
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
|
|
196
200
|
return app;
|
|
197
201
|
}
|
|
198
202
|
|