-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
would be nice to be able to use this for cases where we're loading an entity by an ID and we're like 99.9 percent sure it will be found and we don't want to clog up the code with extra typesafety checks for undefined every time
const result = await db.query.user.findUnique({
where: {
id: 42,
},
})
// => { id: 42, name: 'Chewbacca' } | undefined
const result = await db.query.user.findUniqueOrThrow({
where: {
id: 42,
},
})
// => { id: 42, name: 'Chewbacca' }would be nice if the thrown error was something like: could not find user with id 1 rather than could not find user
Metadata
Metadata
Assignees
Labels
No labels