[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    RE: [PHP-DEV] trigger_error() enhancements
From:       Chris Wright <chrisw () aquacool ! ltd ! uk>
Date:       2013-04-16 16:36:07
Message-ID: 075AE850888292488D400D9632DFE6E102405DE2 () DC01 ! aquacool ! local
[Download RAW message or body]

At 08 April 2013 21:51 Thomas Anderson wrote:

> I was thinking it'd be useful if people could switch between throwing
> exceptions and displaying errors. If throw were a function and not a
> language construct one could do $function($error) where $function was a
> string equal to either 'trigger_error' or 'throw'. But alas that's not
> possible.

    function throw_exception($message, $level =3D 0)
    {
        throw new Exception($message, $level);
    }

;-)

For the record I think that the PHP errors vs. exceptions model kinda
sucks, but I also think that what you propose is even worse (no offence).

> Also, I think it'd be useful if developers could specificy which line
> number and file name the error [...] displays

This I could kind of go with. In particular it would be good to control the
file/line no *printed* without affecting the stack trace. If this is done
though, I would only want to specify how far up the call stack to go to get
this information, rather than actually specifying the values used.

Best Regards

Chris Wright (DaveRandom)

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic