SwiftData - How to properly handle unique constraint violations?

What is the recommended strategy for handling unique constraint violations with SwiftData?

I'm very interested in how this is supposed to work. Right now I just get a crash. The insert doesn't throw and even if I call try modelContext.save() after the insert, I just get a crash rather than an error which I can catch and handle. It's nice that SwiftData can enforce the unique attribute constraint in the underlying database, but what's the point if I can't handle it and the app just crashes?

SwiftData - How to properly handle unique constraint violations?
 
 
Q