ComputerScienceHouse / csh-eval

REPL for PEOPLE
MIT License
7 stars 5 forks source link

Implement Comprehensive Constraint Violation Reporting #110

Open TravisWhitaker opened 8 years ago

TravisWhitaker commented 8 years ago

Hasql provides the ability to discern the exact type of a PostgreSQL error (https://hackage.haskell.org/package/hasql-postgres-0.10.6/docs/Hasql-Postgres-ErrorCode.html#g:16) but it would be nice if we had a higher-level (i.e. dedicated data type) representation of exactly which constraint(s) is/are violated by an action. This makes it much easier to provide meaningful error messages to users/API clients. Unfortunately, unless we resort to TH we'll have to keep this data type aligned with the constraints in the schema manually. Additionally, we only get an error code and message back from PostgreSQL, so we'll need a small parser for determining exactly which constraints were violated.

I'm creating this so I don't forget to implement this later on.