Re: error returning with PEAR::DB
| From: | Lukas Smith | Date: | Tue, 30 Mar 2004 20:31:47 +0000 |
| Subject: | Re: error returning with PEAR::DB | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-11544@lists.php.net to get a copy of this message | ||
Pupeno wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 30 March 2004 17:03, Torsten Roehr wrote:I would expect the error code to match the DB_ERROR_CONSTRAINT constant. if(DB::isError($result) && $result->getCode() == DB_ERROR_CONSTRAINT) { echo 'contraint violation!'; } regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07The only problem I see is that you cannot check WHICH error occurred.Well, that's the key... I catch any error to throw an unexpected error, do some logging latter and so on... If i was to throw a "username in use" error, then, I should be sure that it was a "username in use" error.