Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-4915

Unwrap exceptions from TransactionFailureException

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3.0
    • Fix Version/s: None
    • Labels:
    • Rank:
      1|hzy5w7:

      Description

      Many of CDAP's services use Transactional or TransactionContext (from tephra) to execute code inside a transaction. If that code fails fails for any reason other than a transaction conflict, the exception is wrapped into a TransactionFailureException. This is because otherwise the execute() would have to declare to throw Exception (any exception that might come from the code being executed). However, that TransactionFailureException only carries the original exception, it has no significance by itself.

      When logging or passing exceptions to error callbacks (such as onError()), we should unwrap the original exception from the TransactionFailureException first, and log or handle the original exception.

      This would make it easier for user code to recognize the cause of failures and react appropriately.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andreas Andreas Neumann
                Reporter:
                andreas Andreas Neumann
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: