Convex ents
Hey, ive been playing with using
convex ents
today and like it. I didnt see an answer in the docs so im here...
I like the idea of https://labs.convex.dev/convex-ents/schema#unique-fields , they can be helpful for things like an email field. however, when a uniue field is found, how does the convex function tell me this? I dont see any error type info on ents. I need a way to tell my froend end about this,Ent Schema - Convex Ents
Relations, default values, unique fields and more for Convex
5 Replies
@Michal Srb
It's doing
ctx.db.query(....).unique()
under the hood, so it will throw (during insert
).ah okay, so i can use a
ConvexError
on the client side to check if it didnt work?You can catch the thrown Error on the backend and rethrow a ConvexError, then you can use it on the client side.
okay thanks