<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    In one of the delegation actions, I found that I needed to return an
    action event from way down in several nested method calls.  What I
    came up with was an EventException, which is just a vanilla
    RuntimeException that also carries an event string.  It can then be
    caught in for example doExecute(...), to actually register the
    eventID in the context.  That avoids the need to figure out how to
    do it otherwise when the various methods need to generally return
    other data, and don't want to pollute the interfaces with event
    stuff, or returning booleans, etc.<br>
    <br>
    Do we already have something like this anywhere?  I was thinking of
    generalizing it, say to opensaml-profile-api.  Thoughts?<br>
    <br>
    <br>
    <tt>    /**</tt><tt><br>
    </tt><tt>     * Internal runtime exception class used to terminate
      processing and communicate </tt><tt><br>
    </tt><tt>     * a failure event up the call stack to a common
      location for production of the action event to </tt><tt><br>
    </tt><tt>     * be returned.</tt><tt><br>
    </tt><tt>     */</tt><tt><br>
    </tt><tt>    private static class EventException extends
      RuntimeException {</tt><tt><br>
    </tt><tt>        </tt><tt><br>
    </tt><tt>        /** Serial version UID. */</tt><tt><br>
    </tt><tt>        private static final long serialVersionUID =
      -9159689696046606020L;</tt><tt><br>
    </tt><tt>        </tt><tt><br>
    </tt><tt>        /** The event ID. */</tt><tt><br>
    </tt><tt>        private final String eventID;</tt><tt><br>
    </tt><tt><br>
    </tt><tt>        /**</tt><tt><br>
    </tt><tt>         * Constructor.</tt><tt><br>
    </tt><tt>         *</tt><tt><br>
    </tt><tt>         * @param event the event ID</tt><tt><br>
    </tt><tt>         * @param message the exception details message</tt><tt><br>
    </tt><tt>         * @param cause the exception cause</tt><tt><br>
    </tt><tt>         */</tt><tt><br>
    </tt><tt>        public EventException(@Nonnull final String event,
      @Nullable final String message, </tt><tt><br>
    </tt><tt>                @Nullable final Throwable cause) {</tt><tt><br>
    </tt><tt>            super(message, cause);</tt><tt><br>
    </tt><tt>            eventID =
      Constraint.isNotNull(StringSupport.trimOrNull(event), "Event ID
      may not be null");</tt><tt><br>
    </tt><tt>        }</tt><tt><br>
    </tt><tt><br>
    </tt><tt>        /**</tt><tt><br>
    </tt><tt>         * Get the event represented by this exception.</tt><tt><br>
    </tt><tt>         * </tt><tt><br>
    </tt><tt>         * @return the event ID</tt><tt><br>
    </tt><tt>         */</tt><tt><br>
    </tt><tt>        @Nonnull public String getEvent() {</tt><tt><br>
    </tt><tt>            return eventID;</tt><tt><br>
    </tt><tt>        }</tt><tt><br>
    </tt><tt>        </tt><tt><br>
    </tt><tt>    }</tt><br>
  </body>
</html>