Skip to content

Commit

Permalink
Log any errors that happen during blitz start/build
Browse files Browse the repository at this point in the history
  • Loading branch information
flybayer committed May 1, 2020
1 parent aa5eb90 commit b249ce0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Command} from '@oclif/command'
import {build} from '@blitzjs/server'

// eslint-disable-next-line import/no-default-export
export default class Build extends Command {
static description = 'Create a production build'
static aliases = ['b']
Expand All @@ -13,6 +14,7 @@ export default class Build extends Command {
try {
await build(config)
} catch (err) {
console.error(err)
process.exit(1) // clean up?
}
}
Expand Down
14 changes: 8 additions & 6 deletions packages/cli/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {dev, prod} from '@blitzjs/server'

import {runPrismaGeneration} from './db'

// eslint-disable-next-line import/no-default-export
export default class Start extends Command {
static description = 'Start a development server'
static aliases = ['s']
Expand All @@ -21,14 +22,15 @@ export default class Start extends Command {
rootFolder: process.cwd(),
}

if (flags.production) {
await prod(config)
} else {
try {
try {
if (flags.production) {
await prod(config)
} else {
await dev(config, runPrismaGeneration({silent: true}))
} catch (err) {
process.exit(1) // clean up?
}
} catch (err) {
console.error(err)
process.exit(1) // clean up?
}
}
}

0 comments on commit b249ce0

Please sign in to comment.