Skip to content

Commit

Permalink
fix: Reject db.() with an error object (#4006)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw authored Dec 15, 2022
1 parent 6ece096 commit 74a14b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/calm-papayas-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"blitz": minor
---

When db.\$reset() rejects, reject with an Error object
2 changes: 1 addition & 1 deletion packages/blitz/src/utils/enhance-prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const enhancePrisma = <TPrismaClientCtor extends Constructor>(
const process = spawn(prismaBin, ["migrate", "reset", "--force", "--skip-generate"], {
stdio: "ignore",
})
process.on("exit", (code) => (code === 0 ? res(0) : rej(code)))
process.on("exit", (code) => (code === 0 ? res(0) : rej(new Error(`db.$reset() failed with code ${code}`))))
})
globalThis._blitz_prismaClient.$disconnect()
}
Expand Down

0 comments on commit 74a14b7

Please sign in to comment.