Skip to content

Improve error handling for incorrect raw parameters #2561

@timsuchanek

Description

@timsuchanek

Since Beta 6, we allow parameters in .raw like so:

const result = await prisma.raw(
  'SELECT * FROM User WHERE id = $1 OR email = $2;',
  1,
  '[email protected]'
)

While we chose an API, where each parameter is a separate function arg for .raw, the API could also have looked like this:

const result = await prisma.raw(
  'SELECT * FROM User WHERE id = $1 OR email = $2;',
  [1, '[email protected]']
)

However, if I provide that, I don't get a lot of help but a PANIC:
prisma/prisma-client-js#705

Metadata

Metadata

Assignees

Labels

bug/2-confirmedBug has been reproduced and confirmed.kind/bugA reported bug.tech/enginesIssue for tech Engines.tech/typescriptIssue for tech TypeScript.topic: raw$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-cli

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions