2009年11月23日星期一

[fw-db] error codes, constants, handling duplicate entry exceptions

Just wondering how people are catching and handling Exceptions like "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry..."

In your catch block, do you look for error code 23000, or look for e.g. "duplicate entry" in the message string? If you look at the numeric code, do you hard-code 23000 all over, or is there a class constant somewhere in ZFland, or in your own code?

--
Demand health care for everyone:
http://mobilizeforhealthcare.org/

--
David Mintz
http://davidmintz.org/


没有评论: