Re: Standardized way of interpolating variables into PEAR_Exceptionmessages?

From: Date: Mon, 25 Sep 2006 13:16:15 +0000
Subject: Re: Standardized way of interpolating variables into PEAR_Exceptionmessages?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-44049@lists.php.net to get a copy of this message
Alan Langford wrote: >On 2006 09 24 13:44, Justin Patrin wrote: >> On 9/24/06, Alan Langford <jal@ambitonline.com> wrote: >>> One of the problems with most error/exception mechanisms is that they >>> have a real inclination to take all the semantically meaningful data, >>> jam it into an unparsable string, and pass it back as an error message. >>> >> >> 1) Error message strings have to be there in order to give any useful >> information to the developer. > >Just one point of clarification. There's no way I want to replace the >text message. I was suggesting that in the event of an error that might >be described as "Error 15: Permission failure in process 'foo' while >executing method 'bar'", that the exception have contents similar to this: > >['code'] = 15 >['message'] (as above) >['process'] = 'foo' >['method'] = 'bar' > >This makes it a lot easier for someone doing I8N to prepare their own >message, after understanding the English version, of course. > >My suggestion was that we strongly recommend (if not require) that >packages pass all data used to assemble a variable error message as >separate components of the exception, thus making the I8N process far >easier. > >Thanks for your other comments, I am beginning to get a better handle on >all of this now. Well, with Exception itself you already have: - code - message - line - file - trace And with PEAR_Exception, we added: - class - method or function - cause - custom error data Have a look at the code <http://cvs.php.net/viewcvs.cgi/pear-core/PEAR/Exception.php> Good luck, -- Bertrand Mansion Mamasam Tel : +33 1 48 89 88 26 http://www.mamasam.com Creative Internet Solutions

« previous php.pear.dev (#44049) next »