----- Original Message ----
> From: Lars Nielsen <l...@mit-web.dk>
> To: php-general@lists.php.net
> Sent: Sun, October 11, 2009 2:18:03 PM
> Subject: [PHP] php exception handling
> 
> 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
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Lars,

Here's a pseudo code:

try {
  if (!$valid) {
    throw new Exception("Test failed.");
  } else {
   // do something
  }
} catch (Exception $e) {
  // set/print a user friendly message to send to output

  // set a detailed message using debug_backtrace() or any other information 
relevant for easier troubleshooting
  // log and/or email detailed message
}

Regards,
Tommy


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

Reply via email to