@kevisual/router 0.0.5-alpha-0 → 0.0.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/router-browser.js +2 -1
- package/dist/router-simple.d.ts +1 -1
- package/dist/router-simple.js +1 -7
- package/dist/router.js +2 -1
- package/package.json +1 -1
package/dist/router-browser.js
CHANGED
|
@@ -5745,10 +5745,11 @@ class QueryRouter {
|
|
|
5745
5745
|
catch (e) {
|
|
5746
5746
|
if (route?.isDebug) {
|
|
5747
5747
|
console.error('=====debug====:middlerware error');
|
|
5748
|
+
console.error('=====debug====:', e);
|
|
5748
5749
|
console.error('=====debug====:[path:key]:', `${route.path}-${route.key}`);
|
|
5749
5750
|
console.error('=====debug====:', e.message);
|
|
5750
5751
|
}
|
|
5751
|
-
if (e instanceof CustomError) {
|
|
5752
|
+
if (e instanceof CustomError || e?.code) {
|
|
5752
5753
|
ctx.code = e.code;
|
|
5753
5754
|
ctx.message = e.message;
|
|
5754
5755
|
ctx.body = null;
|
package/dist/router-simple.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare class SimpleRouter {
|
|
|
19
19
|
use(method: string, route: string, ...fns: Array<(req: Req, res: ServerResponse) => Promise<void> | void>): this;
|
|
20
20
|
get(route: string, ...fns: Array<(req: Req, res: ServerResponse) => Promise<void> | void>): this;
|
|
21
21
|
post(route: string, ...fns: Array<(req: Req, res: ServerResponse) => Promise<void> | void>): this;
|
|
22
|
-
parse(req: Req, res: ServerResponse): Promise<void
|
|
22
|
+
parse(req: Req, res: ServerResponse): Promise<void> | "not_found";
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { SimpleRouter };
|
package/dist/router-simple.js
CHANGED
|
@@ -450,13 +450,7 @@ class SimpleRouter {
|
|
|
450
450
|
const { handlers } = route;
|
|
451
451
|
return handlers.reduce((promiseChain, handler) => promiseChain.then(() => Promise.resolve(handler(req, res))), Promise.resolve());
|
|
452
452
|
}
|
|
453
|
-
|
|
454
|
-
res.statusCode = 404;
|
|
455
|
-
res.end('Not Found');
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
console.error('Not Found');
|
|
459
|
-
}
|
|
453
|
+
return 'not_found';
|
|
460
454
|
}
|
|
461
455
|
}
|
|
462
456
|
|
package/dist/router.js
CHANGED
|
@@ -5764,10 +5764,11 @@ class QueryRouter {
|
|
|
5764
5764
|
catch (e) {
|
|
5765
5765
|
if (route?.isDebug) {
|
|
5766
5766
|
console.error('=====debug====:middlerware error');
|
|
5767
|
+
console.error('=====debug====:', e);
|
|
5767
5768
|
console.error('=====debug====:[path:key]:', `${route.path}-${route.key}`);
|
|
5768
5769
|
console.error('=====debug====:', e.message);
|
|
5769
5770
|
}
|
|
5770
|
-
if (e instanceof CustomError) {
|
|
5771
|
+
if (e instanceof CustomError || e?.code) {
|
|
5771
5772
|
ctx.code = e.code;
|
|
5772
5773
|
ctx.message = e.message;
|
|
5773
5774
|
ctx.body = null;
|