Re: php exception handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Lars Nielsen wrote:
Hi,

I am trying to make an exception class that emails the errors to myself.
I have started by using the example by ask at nilpo dot com on
http://dk2.php.net/manual/en/language.exceptions.php.

It work ok but i want it NOT to show the errors on the php-page but only
show the details in the email and then just write eg "An error occurred"
or so on the webpage. Can anyone give me a hint about how to achieve
this?

Regards Lars Nielsen


Don't sell exception handling short; it can be very useful for processing control. Here is an example of a sequence of user input validations and checks.

All check functions throw an exception, with the details, if they find an error. e.g., "Tag <spen> is invalid. Check spelling". This message is rendered so the user can correct his/her mistake.

if(!empty($adminMiscSettingsArray['instrText']))
{
 try{
checkValidTags($validHTMLtags, allProxyTagsArray,adminMiscSettingsArray['instrText']);

  checkTagMatching($emptyProxyTagsArray,$adminMiscSettingsArray['instrText']);
  checkTagNesting($emptyProxyTagsArray, $adminMiscSettingsArray['instrText']);
  checkTextLinks($linksProxyTagsArray, $adminMiscSettingsArray['instrText']);
  }
 catch (Exception $e){
   $instrCheckErrorMsg = $e->getMessage();
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux