[Ur] Exceptions handling
Vladimir Shabanov
vshabanoff at gmail.com
Tue Aug 24 12:09:48 EDT 2010
2010/8/24 Adam Chlipala <adamc at impredicative.com>:
>> There are several ways to add exceptions.
>>
>
> 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.
Hmm. Of course I can check constraint violations.
Interesting is there any way for Ur to force programmer to check
violations (don't allow DML w/o necessary checks)? (but I'm afraid
that it can be more complex than adding exceptions ;).
And there is another way to check DML errors -- another function dml'
can be adder which returns option string instead of error page, e.g.
result <- dml' (...);
case result of
None => return "ok"
Some e => return strcat("dberror: ", e)
More information about the Ur
mailing list