Mercurial > hg4j
diff src/org/tmatesoft/hg/core/HgCallbackTargetException.java @ 370:a2341e761609
Let callback implementations deliver errors (e,g. own exceptions) to client code
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 22 Dec 2011 02:37:10 +0300 |
parents | 2fadf8695f8a |
children | f52ca9530774 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgCallbackTargetException.java Thu Dec 22 01:46:40 2011 +0300 +++ b/src/org/tmatesoft/hg/core/HgCallbackTargetException.java Thu Dec 22 02:37:10 2011 +0300 @@ -21,7 +21,14 @@ /** - * Checked exception that indicates errors in client code and tries to supply extra information about the context it occured in. + * Checked exception that indicates errors in client code and tries to supply extra information about the context it occurred in. + * + * Generally, client need to pass own error information/exceptions from within implementations of the callback methods they supply. + * However, there's no straightforward way to alter throws clause for these methods, and alternatives like generic {@link Exception} or + * library's own {@link HgException} are rather obscure. Suggested approach is to wrap whatever exception user code produces with + * {@link RuntimeException} subclass, {@link Wrap}. Then, unwrap and re-throw with checked {@link HgCallbackTargetException}. + * + * FIXME REVISIT perhaps, shall just throw HgCallbackTargetException from any handler, and do not catch anything in commands at all? * * @author Artem Tikhomirov * @author TMate Software Ltd.