[Ur] Exceptions handling

Leon Smith leon.p.smith at gmail.com
Tue Aug 24 13:31:44 EDT 2010


On Tue, Aug 24, 2010 at 11:34 AM, Adam Chlipala <adamc at impredicative.com> wrote:
> This is certainly a thorough list of ways of supporting general
> exception-handling, but I had hoped (and continue to hope) Ur wouldn't need
> any such facility. ;)
>
> Why can't you just check for uniqueness constraint violations in your code
> before inserting into the database?  I can see the case for a simple
> facility for specifying an alternate error-reporting page, but more than
> that doesn't seem worthwhile.  These errors should only come up in buggy
> programs.

Unless you move these checks into the DML itself,  this requires an
extra round-trip to the database.   If issuing the check in the DML is
infeasible or undesirable,  for performance reasons,  you really do
want some kind of exception handling facility.  (Though honestly,  I
tend to prefer to catch the exception close to the point that the DML
is issued, and project it into a value such as the Either type...
certainly the database access layer could do this for me,  but they
usually don't.)



More information about the Ur mailing list