Reply to Re: Error Trapping Within Classes

Your name:

Reply:


Posted by ZeldorBlat on 09/19/06 14:09

47computers@gmail.com wrote:
> Pretty new to PHP, I recently started learning about error trapping.
> As of right now, I include the following into a page in my website:
>
> -------BEGIN PASTE--------
> error_reporting(E_ERROR | E_PARSE);
> set_error_handler("SendErrorReport");
>
> function SendErrorReport($errorNumber, $errorMessage, $errorFile,
> $errorLine, $vars)
> {
> [code for handling the error, reporting it to the admin, etc.]
> }
> ---------END PASTE---------
>
> This is working great and catching everything I'd want to catch on the
> page. However, it's not catching any errors that happen within a
> class.
>
> For example, the page that has this code also creates an instance of a
> given class. It then calls a function on that class. Within that
> function in the class's code, I would mess up a line to test the error
> trapping, and it is not trapped with the above code, but instead by the
> default error handling.
>
> How should I go about also trapping the errors that occur within the
> class? Any advice would be much appreciated, thank you.
>
>
> -David

What do you mean by "mess up a line" ? Change it to include invalid
syntax? From the PHP manual on set_error_handler() :

<snip>
The following error types cannot be handled with a user defined
function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING,
E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the
file where set_error_handler() is called.
</snip>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация