Re: [picocontainer-dev] Exception as message passing in ConstantParameter

Paul Hammant <[email protected]> Mon, 7 Jul 2008 07:36:34 -0700
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
>> or a core code-path.  Maybe not now, but verify(..) could
>> return
>> something more sophisticated than void.
>
> AFAIR, using exceptions to signal outcomes is considered
> antipattern.  But it would be difficult to produce meaningful error  
> message outside of parameters otherwise.


We could use a callback. Such that ..

     void verify(PicoContainer container, Co ... etc

.. would become ..

     Verification verify(PicoContainer container, Co ... etc

     public class Verified implements Verification {
     }
     public abstract class NotVerified implements Verification {
        public abstract void throwCause();
     }

It implies that if you have verification exceptions, you throw then  
via callback impl of NotVerified

It also implies some if/else checking in various bits of the verify  
hierarchy

- Paul

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email