From:             evert at rooftopsolutions dot nl
Operating system: Any
PHP version:      5.3.0RC3
PHP Bug Type:     Feature/Change Request
Bug description:  Create a 'Throwable' interface.

Description:
------------
I'd like to have a 'Throwable' interface. Any class implementing this
interface can be 'thrown' as an exception.

This is my usecase:

I want to implement :

interface MyAPP_NotFoundException extends Throwable { }

This interface can be freely used by other exception classes,
and all it tells my exception handler, is that I'm supposed 
to send back a '404' status code back to the client.

I cannot simply create an abstract class, because this the classes
implementing NotFoundException might be part of an unrelated
structure and require methods and properties from other ancestor classes.

Alternatively (but similarly), I'd like to be able to define an interface
that will give certain exceptions the ability to override a statuscode
altogether:

interface MyAPP_HTTPException extends Throwable { 
     function getHTTPStatusCode();
}

'Throwable' can be a virtual interface, much like 'Traversable'. This will
allow me to make sure that any class implementing HTTPException, will also
be throwable.

Right now I'm simply defining these interfaces without an ancestor
interface, which works.. but it's not perfect :)


-- 
Edit bug report at http://bugs.php.net/?id=48599&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48599&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48599&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48599&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48599&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48599&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48599&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48599&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48599&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48599&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48599&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48599&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48599&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48599&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48599&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48599&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48599&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48599&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48599&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48599&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48599&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48599&r=mysqlcfg

Reply via email to