Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-237

Location specifier for exceptional exit

    Details

      Description

      It would be very helpful to be able to inject code upon method throwing an exception, or code executed regardless of the way the control flow returns from the function.

      In order to be backwards compatible I'd suggest location specifiers

      AT EXIT THROWING [exception type, defaults to Throwable]
      = try { /* method body */ } catch ( /* exception type */ $!) { /* rule contents */ throw $!; }
      
      AT EXIT FINALLY
      = try { /* method body */ } finally { /* rule contents */ throw $!; }
      
      AFTER INVOKE (regular AFTER INVOKE args) THROWING [exception type, defaults to Throwable]
      = try { /* method invocation */ }  catch ( /* exception type */ $!) { /* rule contents */ throw $!; }
      
      AFTER INVOKE (regular AFTER INVOKE args) FINALLY
      = try { /* method invocation */ } finally { /* rule contents */ throw $!; }
      

      Are there any caveats with this? The latter two should obviously introduce some local variable where the return value would be temporarily stored...

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                adinn Andrew Dinn
                Reporter:
                rvansa Radim Vansa
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: