01: /*
02: * Created on 1 Jun 2007
03: */
04: package uk.org.ponder.rsf.flow.errors;
05:
06: import uk.org.ponder.rsf.viewstate.AnyViewParameters;
07: import uk.org.ponder.rsf.viewstate.ViewParameters;
08: import uk.org.ponder.util.UniversalRuntimeException;
09:
10: /** A ViewExceptionStrategy that will "pass through" any errors by rethrowing
11: * them. This will upgrade them to the category of fatal errors and hence
12: * pass them to a {@link uk.org.ponder.rsf.processor.FatalErrorHandler}.
13: *
14: * @author Antranig Basman (antranig@caret.cam.ac.uk)
15: *
16: */
17:
18: public class PropagatingViewExceptionStrategy implements
19: ViewExceptionStrategy {
20:
21: private Class[] propagated;
22:
23: public void setPropagatedExceptions(Class[] propagated) {
24: this .propagated = propagated;
25: }
26:
27: public AnyViewParameters handleException(Exception e,
28: ViewParameters incoming) {
29: Exception unwrapped = (Exception) UniversalRuntimeException
30: .unwrapException(e);
31: if (propagated != null) {
32: for (int i = 0; i < propagated.length; ++i) {
33: if (propagated[i].isInstance(unwrapped))
34: throw UniversalRuntimeException.accumulate(e);
35: }
36: }
37: return null;
38: }
39:
40: }
|