title: How to get exception inside ActionInvocation.invoke()
body: <p>First of all the final purpose is that i'm trying to inject a DAO connection into an SMD context (Ajax) so i'll ensure that transactions are being Commited (or Rollback), my problem is that i'm not being able to know if the invoke() method throws an exception,</p>
  <p>I have the following Interceptor:</p>
  <pre><code>public class SomeInterceptor implements Interceptor {
      private static final long serialVersionUID = 1L;
      @Override
      public String intercept(ActionInvocation invocation) {
          String result = &quot;&quot;;
          GenericDAO dao = new GenericDAO();
          try {
              dao.begin();
              invocation.getInvocationContext().put(&quot;contextDao&quot;, dao);
              result = invocation.invoke();
              //attempt to solve
              Object exception = invocation.getInvocationContext().getValueStack().findValue(&quot;exception&quot;);
              if (exception != null &amp;&amp; exception instanceof Exception){
                  dao.rollback();
              } else {
                  dao.commit();
              }
          } catch (Exception ex) {
              dao.rollback();
              System.out.println(&quot;ROLLBACK!&quot;);
              ex.printStackTrace();
          } finally {
              dao.close();
          }
          return result;
      }
  }
  </code></pre>
  <p>The line &quot;attempt to solve&quot; is based on <a href="https://stackoverflow.com/q/10313279/1657465">this</a> question. Inside the invoke i'm just throwing a NullPointerException, the result right now is that the exception is being catch before the catch at the Interceptor, however is not a catch that i had set,</p>
  <pre><code>@SMDMethod
  public HashMap&lt;String,String&gt; someMethod() {
      IGenericDAO dao = (IGenericDAO) ActionContext.getContext().get(&quot;contextDao&quot;);
      //dao's deletes, updates that i want to rollback
      HashMap&lt;String,String&gt; x = null;
      x.put(&quot;x&quot;,&quot;x&quot;); //&lt;---- NPE!
      return null;
  }
  </code></pre>
  <p>I want ActionInvocation.invoke() to throw the exception so i'll know i need to rollback the DB session. Any approach who succeed this purpose is welcome,</p>
  <p><strong>Edit 1:</strong>
  I've found <a href="https://stackoverflow.com/q/15269786/1657465">this</a> question that does almost the same as me but i dont understand how is using rollback (at my point of view is always doing rollback)</p>
  <p>Greetings</p>