Skip to content

Commit

Permalink
fix(build): show file info on error
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Apr 28, 2024
1 parent 9794877 commit f0debd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/node/cli.ts
Expand Up @@ -48,7 +48,7 @@ if (!command || command === 'dev') {
}
createDevServer().catch((err) => {
createLogger().error(
`${c.red(`failed to start server. error:`)}\n${err.stack}`
`${c.red(`failed to start server. error:`)}\n${err.message}\n${err.stack}`
)
process.exit(1)
})
Expand All @@ -59,13 +59,15 @@ if (!command || command === 'dev') {
logVersion()
if (command === 'build') {
build(root, argv).catch((err) => {
createLogger().error(`${c.red(`build error:`)}\n${err.stack}`)
createLogger().error(
`${c.red(`build error:`)}\n${err.message}\n${err.stack}`
)
process.exit(1)
})
} else if (command === 'serve' || command === 'preview') {
serve(argv).catch((err) => {
createLogger().error(
`${c.red(`failed to start server. error:`)}\n${err.stack}`
`${c.red(`failed to start server. error:`)}\n${err.message}\n${err.stack}`
)
process.exit(1)
})
Expand Down
6 changes: 4 additions & 2 deletions src/node/plugins/dynamicRoutesPlugin.ts
Expand Up @@ -200,8 +200,10 @@ export async function resolveDynamicRoutes(
'silent'
)) as RouteModule
routeModuleCache.set(pathsFile, mod)
} catch (e: any) {
logger.warn(`${c.yellow(`Failed to load ${pathsFile}:`)}\n${e.stack}`)
} catch (err: any) {
logger.warn(
`${c.yellow(`Failed to load ${pathsFile}:`)}\n${err.message}\n${err.stack}`
)
continue
}
}
Expand Down

0 comments on commit f0debd2

Please sign in to comment.