dwhjames/datomisca

Naming consistency for DatomicMapping.fromEntity

Closed this issue · 2 comments

To be consistent with DDatabase.{entity, entityOpt, tryEntity}, we should have DatomicMapping.fromEntity throw an exception and have fromEntityOpt and tryFromEntity variants.

The same nomenclature could be followed for DatomicFacilities.resolveEntity (which uses DDatabase.entity internally)

I’m starting to think that we should just prefer throwing exceptions in most cases, and the client can just to wrap the calls with Try { … }.

Option doesn’t seem to make sense in many cases… unlike a general map, where one doesn’t necessarily have prior knowledge of the keys, here the keys of entities correspond to the schema, so we have perfect knowledge of the key space, so ‘key not found’ really is exceptional behavior.