Reply to Re: How to trigger an error inside a function and make it come from where it was called?

Your name:

Reply:


Posted by Rik Wasmus on 10/11/81 12:00

On Tue, 15 Jan 2008 14:51:35 +0100, Bruno Rafael Moreira de Barros
<brunormbarros@gmail.com> wrote:

> On Jan 14, 1:56 pm, "C. (http://symcbean.blogspot.com/)"
> <colin.mckin...@gmail.com> wrote:
>> On 14 Jan, 11:08, Bruno Rafael Moreira de Barros
>>
>> <brunormbar...@gmail.com> wrote:
>> > I want the trigger_error to say the error came from application.php
>> > and the line where it came from. I have a custom error handler, so if
>> > some change on the error handler (or test1(), for that matter) is
>> > needed, I will gladly do it.
>>
>> These *are* the parameters to the customer error handler.
>>
>> fromhttp://uk.php.net/manual/en/function.set-error-handler.php
>>
>> The third parameter is optional, errfile , which contains the
>> filename that the error was raised in, as a string.
>> The fourth parameter is optional, errline , which contains the line
>> number the error was raised at, as an integer.
>>
>> See also:http://uk.php.net/debug_backtrace
>
> Yes, but the problem is, the error line and file equal to the ones
> that lead you to the declaration of the function...

Check the link provided to you, the custom handler could examine the
contents of debug_backtrace(), and optionally provide a whole trace, or it
could 'skip' the last step in the backrace based on the function name.

> And you check the error log, all the errors will have come from the
> same place, from inside test1(). But I tested try...catch and it
> worked, and it even solved further problems I had.

Hmmm, I like Exceptions indeed :).
--
Rik Wasmus

[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

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