erquhart
erquhart14mo ago

db.delete on non-existent id

Does ctx.db.delete throw if the id doesn't exist?
3 Replies
lee
lee14mo ago
Yep, as do patch and replace. If you don't want to throw an error (or you want to throw it to the client as ConvexError), you can catch the error or check for existence transactionally with a db.get
erquhart
erquhartOP14mo ago
Cool, just double checking 👍 Would be good to have that info in the api docs
winsoroaks
winsoroaks14mo ago
TIL ConvexError... it's so useful for parsing the error on the client side. kicking myself for not finding out earlier 🤦‍♂️

Did you find this page helpful?