1 Reply Latest reply on Jan 22, 2013 7:44 AM by rvansa

    AFTER INVOKE bar() with bar() throwing an exception

    belaban

      Hi there (Andrew),

       

      (I searched the web but haven't found an answer to this problem)...

       

      I have a rule that needs to do something after bar() has been invoked, *regardless* of whether bar() returns normally or throws an exception:

       

      RULE

      CLASS Foo

      METHOD bla

      AFTER INVOKE bar

      IF TRUE

        DO System.out.println("action invoked");

      ENDRULE

       

       

      The action gets only triggered when bar() returns normally. I was kind of hoping this would also be fired even when bar() (or code it called) threw an exception, but that doesn't seem to be the case.

       

      How can I achieve this ?

       

      Thanks !

        • 1. Re: AFTER INVOKE bar() with bar() throwing an exception
          rvansa

          I second this feature request; also having AT THROW handling only direct throw new FooException(); is somewhat counterintuitive (the documentation does not emphasise this a lot). Maybe there could be another AT EXITTHROW, or even FINALLY trigger point which would catch all exceptions into $^.