CoNarrative / precept

A declarative programming framework
MIT License
657 stars 33 forks source link

Support error messages via rules for unique/value attributes #51

Closed alex-dixon closed 7 years ago

alex-dixon commented 7 years ago

This came up specifically in relation to uniqueness and how we handle it. It seems we do want to support the equivalent of db.unique/value, where the behavior is not upsert but to throw an error.

This brings us to a very important part of the API that we need to beef up, which is errors in general. Edit: Not actually errors but...you know what I mean

For this, we'd like to surface error messages via rules, allowing users to handle them via rules. The range of possibilities here is huge and very exciting.

For now the goal is to implement this when a :unique/value attribute is about to be overwritten. Should be relatively straightforward as we detect this inside of insert, so we can easily add a new "error" fact. We should consider a precept.spec.error ns if we need it for well-defined "error facts".

alex-dixon commented 7 years ago

Implemented #59