@@ -70,10 +70,18 @@ public final T execute() throws InvalidProcessStateException, ProcessExecutionEx
7070 result = doExecute ();
7171 setState (ProcessState .EXECUTION_SUCCEEDED );
7272 notifyListeners (ProcessState .EXECUTION_SUCCEEDED );
73- } catch (ProcessExecutionException ex ) {
73+ } catch (Exception ex ) {
7474 setState (ProcessState .EXECUTION_FAILED );
7575 notifyListeners (ProcessState .EXECUTION_FAILED );
76- throw ex ;
76+
77+ // log exception, wrap it to PEE, throw
78+ String msg = "An unexpected exception has been catched during execution." ;
79+ logger .error (msg , ex );
80+ if (ex instanceof ProcessExecutionException ) {
81+ throw ex ;
82+ } else {
83+ throw new ProcessExecutionException (this , ex , msg );
84+ }
7785 }
7886 return result ;
7987 }
@@ -112,10 +120,18 @@ public final T rollback() throws InvalidProcessStateException, ProcessRollbackEx
112120 result = doRollback ();
113121 setState (ProcessState .ROLLBACK_SUCCEEDED );
114122 notifyListeners (ProcessState .ROLLBACK_SUCCEEDED );
115- } catch (ProcessRollbackException ex ) {
123+ } catch (Exception ex ) {
116124 setState (ProcessState .ROLLBACK_FAILED );
117125 notifyListeners (ProcessState .ROLLBACK_FAILED );
118- throw ex ;
126+
127+ // log exception, wrap it to PRE, throw
128+ String msg = "An unexpected exception has been catched during rollback." ;
129+ logger .error (msg , ex );
130+ if (ex instanceof ProcessRollbackException ) {
131+ throw ex ;
132+ } else {
133+ throw new ProcessRollbackException (this , ex , msg );
134+ }
119135 }
120136 return result ;
121137 }
0 commit comments