From 1b7fa938ba85612f3f6897d44e7d5f39301cf25b Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Thu, 12 Mar 2009 20:59:33 +0000 Subject: [PATCH] javadoc --- .../engine/FlowExecutionExceptionHandler.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java index 68061086..e4121233 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java @@ -15,11 +15,26 @@ */ package org.springframework.webflow.engine; +import org.springframework.webflow.engine.support.TransitionExecutingFlowExecutionExceptionHandler; import org.springframework.webflow.execution.FlowExecutionException; /** * A strategy for handling an exception that occurs at runtime during the execution of a flow definition. * + * Note: special care should be taken when implementing custom flow execution exception handlers. Exception handlers are + * like Transitions in that they direct flow control when exceptions occur. They are more complex than Actions, which + * can only execute behaviors and return results that drive flow control. For this reason, if implemented incorrectly, a + * FlowExecutionHandler can leave a flow execution in an invalid state, which can render the flow execution unusable or + * its future use undefined. For example, if an exception thrown at flow startup gets routed to an exception handler, + * the handler must take responsibility for ensuring the flow execution returns control to the caller in a consistent + * state. Concretely, this means the exception handler must transition the flow to its start state. The handler should + * not simply return leaving the flow with no current state set. + * + * Note: Because flow execution handlers are more difficult to implement correctly, consider catching exceptions in your + * web flow action code and returning result events that drive standard transitions. Alternatively, consider use of the + * existing {@link TransitionExecutingFlowExecutionExceptionHandler} which illustrates the proper way to implement an + * exception handler. + * * @author Keith Donald */ public interface FlowExecutionExceptionHandler { @@ -32,8 +47,8 @@ public interface FlowExecutionExceptionHandler { public boolean canHandle(FlowExecutionException exception); /** - * Handle the exception in the context of the current request, optionally making an error view selection that should - * be rendered. + * Handle the exception in the context of the current request. An implementation is expected to transition the flow + * to a state using {@link RequestControlContext#execute(Transition)}. * @param exception the exception that occurred * @param context the execution control context for this request */