You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Robert Zeigler (JIRA)" <ji...@apache.org> on 2009/02/23 19:10:46 UTC

[jira] Commented: (CAY-1165) Stop unwinding runtime exceptions

    [ https://issues.apache.org/cayenne/browse/CAY-1165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13252#action_13252 ] 

Robert Zeigler commented on CAY-1165:
-------------------------------------

What if we added a marker annotation to exceptions that need to be unwound? I haven't looked through the codebase (and I don't know which ones ought to be unwound or not, offhand), so not sure how feasible this would be (eg: if you wanted some "CayenneExceptions" to be unwound, and others not, that would be hairier).  

But if we /could/ annotate those exceptions, then Util.unwindException could check for the annotation, return the original exception as necessary, or unwind if necessary.

> Stop unwinding runtime exceptions
> ---------------------------------
>
>                 Key: CAY-1165
>                 URL: https://issues.apache.org/cayenne/browse/CAY-1165
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Cayenne Core Library
>    Affects Versions: 3.0M5
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.0M6
>
>
> The practice of unwinding Cayenne exceptions seemed like  a good idea at the time. This would look like:
>        try {
>           ....
>         }
>         catch (Exception ex) {
>             throw new CayenneException("Exception", Util.unwindException(ex));
>         }
> And was supposed to trim Exception chain to just the underlying cause plus a Cayenne[Runtime]Exception wrapper. However in many cases intermediate places where Cayenne catches exception, wraps it and rethrows, provide additional forensics info helping to identify the cause. For instance FieldAccessor shows which field has failed:
>        try {
>             field.set(object, newValue);
>         }
>         catch (Throwable th) {
>             throw new PropertyException(
>                     "Error writing field: " + field.getName(),
>                     this,
>                     object,
>                     th);
>         }
> So I think we should get rid of all calls to Util.unwindException(..) and rethrow it unchanged.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.