-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 8/24/10 5:34 PM, Adam Chlipala wrote: > 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.
Wouldn't checking the uniqueness constraint first require an additional database query? My experience is that the web application idiom usually suggests trying-and-failing in such a case. Similarly, there does seem to be a case for some kind of exception handling mechanism for cases where things that aren't obvious bugs cause queries to fail (e.g. the database server goes away unexpectedly). My personal preference would just be a simple ML-style "handle" mechanism, or failing that, the ability to define user-provided callback functions for the types of exceptions that cannot reasonably be prevented (e.g. in the simplest case, a global user-defined error function that takes some error identifier as a parameter and returns a page), such that one could define error pages within the application structure. - --Gian -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMdBiwAAoJEDd5xfOXfbYMMgsH/RqIYIq5g2DvBzbgc12MyMr8 fx16Sh1HRR1zbyaOUUxX8+4oUMzB6/yZcavPHZHnWDKQ/MrmSbNVCmwb1+Pd2FBg pMjeOMvLYMkYfdbcQbb4S/YuOkEX/mCcNTfHR/fVNAmKwh/xxl/UegAkS3yyKxtd k7BzV8+7raPgSNZlZ4XDeNE01yJ5X83anDXukCGhrTzkVK71KGM7/2eS6PnAUO99 tXjhb4r3ia6qtzwXbwFlP/U8EjlZNAB2fKE0RujTr01UXLKmW5YEdKR00g8mDCQ7 YFfSeyccW2qL07mfuIlUz0q+FP3WM/dPertYoj6fu+17fS4ZXWMI8TkQnfIQWLk= =H3d4 -----END PGP SIGNATURE----- _______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
