Hi @TopherGopher,
Looks like all of these are server errors, so they should all be of type mongo.CommandError. The trickiest one is DuplicateKey because the format of that error has changed over server versions. For example, it might be returned as a write error from the server, in which case it’d be a mongo.WriteException or mongo.BulkWriteException, depending on the method you use (all writes return a WriteException except for InsertMany and BulkWrite).
The DuplicateKey case is definitely confusing. There’s an open GODRIVER ticket to implement something like mgo’s IsDup function to handle all of that logic: https://jira.mongodb.org/browse/GODRIVER-972.
– Divjot