1 package org.apache.velocity.app.event; 2 3 import org.apache.velocity.context.Context; 4 import org.apache.velocity.util.introspection.Info; 5 6 /* 7 * Licensed to the Apache Software Foundation (ASF) under one 8 * or more contributor license agreements. See the NOTICE file 9 * distributed with this work for additional information 10 * regarding copyright ownership. The ASF licenses this file 11 * to you under the Apache License, Version 2.0 (the 12 * "License"); you may not use this file except in compliance 13 * with the License. You may obtain a copy of the License at 14 * 15 * http://www.apache.org/licenses/LICENSE-2.0 16 * 17 * Unless required by applicable law or agreed to in writing, 18 * software distributed under the License is distributed on an 19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 * KIND, either express or implied. See the License for the 21 * specific language governing permissions and limitations 22 * under the License. 23 */ 24 25 /** 26 * Event handler called when a method throws an exception. This gives the 27 * application a chance to deal with it and either 28 * return something nice, or throw. 29 * 30 * Please return what you want rendered into the output stream. 31 * 32 * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a> 33 * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a> 34 * @version $Id$ 35 */ 36 public interface MethodExceptionEventHandler extends EventHandler 37 { 38 /** 39 * Called when a method throws an exception. 40 * Only the first registered MethodExceptionEventHandler is called. If 41 * none are registered a MethodInvocationException is thrown. 42 * 43 * @param context current context 44 * @param claz the class of the object the method is being applied to 45 * @param method the method 46 * @param e the thrown exception 47 * @param info contains template, line, column details 48 * @return an object to insert in the page 49 * @throws RuntimeException an exception to be thrown instead inserting an object 50 */ methodException(Context context, Class<?> claz, String method, Exception e, Info info)51 Object methodException(Context context, Class<?> claz, String method, Exception e, Info info); 52 } 53