Re: [PHP.next] Error-handling using "Error Events"

From: Date: Wed, 09 Apr 2014 18:32:17 +0000
Subject: Re: [PHP.next] Error-handling using "Error Events"
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-73653@lists.php.net to get a copy of this message
Marco Schuster wrote (on 09/04/2014):
The fopen shut-up actually could be resolved much, much more elegant: make it throw*real, usable exceptions*, instead of returning a FALSE and spitting out a warning.
Good point. Perhaps the real question is: what are the use cases - real or perceived - for the @ operator, and how, if we were re-organising error and message handling in general, can they best be replaced. The only problem is that changing the behaviour of such a basic function is quite a major compatibility break, and there may need to be some way of switching to the old behaviour in order to use code which pre-dates the change, or write code which works in both versions.
Something like DomainNotFoundException, ConnectionDeniedException, FileNotFoundException or whatnot. It's a nightmare if you actually want to know what happened.
The problem with such specific exceptions in this case is that different stream wrappers would want to throw completely different exceptions; I guess they could all extend a generic FileAccessException. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#73653) next »