Hi Jorg, Actually you can declare handlers in methods and/or class and use a special invocation in your catch block -- HandlerUtil.handle(e) -- to tell it you want to use the declared exception. This is the more flexible approach, because you can handle only what you want.
The other option is to let Jeha put the method invocation automatically, by a Ant task through Javassist. In this case it's not necessary to codify anything (only annotation) and all catch blocks will contain a call to HandlerUtil.handle(e). In relation to rethrow, Jeha uses this interface to handle any exception specified by the user: public interface Handler { public Throwable handle(Throwable throwable, Object... methodParams); } Since handle() method returns Throwable, you can rethrow an exception any time you want. Regards, Andre -----Mensagem original----- De: news [mailto:n...@ger.gmane.org] Em nome de Jörg Schaible Enviada em: quarta-feira, 8 de abril de 2009 03:43 Para: dev@commons.apache.org Assunto: Re: Possible incubation? Hi Andre, Andre Dantas Rocha wrote at Dienstag, 7. April 2009 14:38: > Hi all, > > This message was originally sent to incubator list, but they suggest to > post it here because *maybe* the idea can fit in Commons project. > > I'm developing a framework called Jeha. The main idea is to provide easy > exception description and handling using annotations in methods and > classes > and some commons handlers. I believe that the idea is simple, but > powerful. > > The initial code and start guide of framework are here: > <http://sourceforge.net/project/showfiles.php?group_id=242203&package_id=294 > 931&release_id=650572> > http://sourceforge.net/project/showfiles.php?group_id=242203&package_id=2949 > 31&release_id=650572 > > I'd like to hear from community if this idea is valuable for a possible > incubation. > > Please let me know your opinion. It might be only me, but I see this approach a bit critical. On one hand you're right, writing exception code is quite tedious sometimes, but with your solution you wipe out any useful method signature regarding exception declaration. What happens if I don't wanna handle certain exception types or RuntimeException instances? I cannot simply rethrow from the handler. - Jörg --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org