Uploaded image for project: 'Log Tool'
  1. Log Tool
  2. LOGTOOL-31

Allow exception methods to set fields on the exception object

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.CR3
    • None
    • None

      Create a new annotation called @Field which accepts a single string parameter. For methods which return an exception, the values of these parameters will be assigned to fields on the exception object with the corresponding name.

      For example:

      @Message(id = 1000, "The transaction failed because blah blah %s")
      XAException transactionFailedBlah(String blah, @Field("errorCode") int errorCode);
      
      // should also continue to work with @Cause in conjunction with exceptions which don't have a cause param:
      
      @Message(id = 1001, "The operation was interrupted unexpectedly by %s")
      InterruptedIOException surprise(String reason, @Cause Throwable someCause, @Field("bytesTransferred") int bytesTransferred);
      

            jperkins-rhn James Perkins
            dlloyd@redhat.com David Lloyd
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: