Naming consistency for DatomicMapping.fromEntity
Closed this issue · 2 comments
dwhjames commented
To be consistent with DDatabase.{entity, entityOpt, tryEntity}
, we should have DatomicMapping.fromEntity
throw an exception and have fromEntityOpt
and tryFromEntity
variants.
dwhjames commented
The same nomenclature could be followed for DatomicFacilities.resolveEntity
(which uses DDatabase.entity
internally)
dwhjames commented
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.