You are here: Re: How to trigger an error inside a function and make it come from where it was called? « PHP Programming Language « IT news, forums, messages
Re: How to trigger an error inside a function and make it come from where it was called?

Posted by Bruno Rafael Moreira de Barros on 09/28/95 12:00

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
>
> C.

Yes, but the problem is, the error line and file equal to the ones
that lead you to the declaration of the function...

So if you have:

test1(); // trigger the error
test1(); // trigger the error
test1(); // trigger the error
test1(); // trigger the error
test1(); // trigger the error
test1(); // trigger the error
test1(); // trigger the error

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.

 

Navigation:

[Reply to this 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

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