Is it possible to distinguish in the `rejectOnNotF...
# orm-help
r
Is it possible to distinguish in the
rejectOnNotFound
to which of the provided where conditions makes the query return
null
? (see screenshot with code)
Otherwise, I’d have to run some queries for the provided ids, e.g. 1. check first where condition (authorId)
Copy code
const post = await ctx.prisma.post.findFirst({
  where: { authorId },
  rejectOnNotFound: (e) => Error(`Unable to find a post for author with id ${authorId}`),
});
2. check second where condition (departmendId) similarly 3. If both don’t throw, I return my actually query with both `where`s
I know you guys have an epic open about Error Management, but I was unable to find anything for this particular use case (which I encounter quite often!) https://github.com/prisma/prisma/issues/3488
a
Hey Richard 👋, This is not possible today, but sounds like a great feature request to capture. Would you mind filling one out?
r
Hi @Austin thanks for the quick turnaround. I’ve filed an issue about this.