Skip to content

Commit 42b2f71

Browse files
committed
fix(templates): update error type to MyError to fix wrong error type problem
1 parent 2904d8e commit 42b2f71

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

generators/app/templates/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { MyError } from '@boringcodes/utils/error';
12
import errorHandler from '@boringcodes/utils/errorHandler';
23
import logger from '@boringcodes/utils/logger';
34

@@ -14,7 +15,7 @@ const port =
1415
: 9000;
1516

1617
// start app
17-
app.listen(port, host, (err: Error) => {
18+
app.listen(port, host, (err: MyError) => {
1819
if (err !== null && err !== undefined) {
1920
throw err;
2021
}
@@ -23,11 +24,11 @@ app.listen(port, host, (err: Error) => {
2324
});
2425

2526
// handle unhandled promise
26-
process.on('unhandledRejection', (err: Error) => {
27+
process.on('unhandledRejection', (err: MyError) => {
2728
throw err;
2829
});
2930

3031
// handle uncaught error and gracefully shutdown
31-
process.on('uncaughtException', (err: Error) => {
32+
process.on('uncaughtException', (err: MyError) => {
3233
errorHandler.handle(err);
3334
});

0 commit comments

Comments
 (0)