Skip to content

Commit

Permalink
fix(cli): Revert change to prisma error message (#8825)
Browse files Browse the repository at this point in the history
**Problem**
Prisma handles it's own error messaging so we don't want to throw to the
top level try catch in that case.

**Changes**
1. Restores the try catch in the handler.

@jtoar - Address the problem you raised. I'm not sure the milestone for
this one.
  • Loading branch information
Josh-Walker-GM authored Jul 4, 2023
1 parent a4e21e9 commit 875ad73
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions packages/cli/src/commands/prismaHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import boxen from 'boxen'
import execa from 'execa'

import { recordTelemetryAttributes } from '@redwoodjs/cli-helpers'
import { errorTelemetry } from '@redwoodjs/telemetry'

import c from '../lib/colors'
import { getPaths } from '../lib/index'
Expand Down Expand Up @@ -64,19 +65,24 @@ export const handler = async ({ _, $0, commands = [], ...options }) => {
console.log(c.underline('$ yarn prisma ' + args.join(' ')))
console.log()

execa.sync(
`"${path.join(rwjsPaths.base, 'node_modules/.bin/prisma')}"`,
args,
{
shell: true,
cwd: rwjsPaths.base,
stdio: 'inherit',
cleanup: true,
}
)
try {
execa.sync(
`"${path.join(rwjsPaths.base, 'node_modules/.bin/prisma')}"`,
args,
{
shell: true,
cwd: rwjsPaths.base,
stdio: 'inherit',
cleanup: true,
}
)

if (hasHelpOption || commands.length === 0) {
printWrapInfo()
if (hasHelpOption || commands.length === 0) {
printWrapInfo()
}
} catch (e) {
errorTelemetry(process.argv, `Error generating prisma client: ${e.message}`)
process.exit(e?.exitCode || 1)
}
}

Expand Down

0 comments on commit 875ad73

Please sign in to comment.