1 /* 2 * Copyright the original author or authors. 3 * 4 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.mozilla.org/MPL/MPL-1.1.html 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import org.as2lib.io.conn.core.event.MethodInvocationErrorInfo; 18 19 /** 20 * {@code MethodInvocationErrorListener} awaits an error response of a method 21 * invocation. 22 * 23 * <p>When and why the event method is invoked depends on the used client. 24 * 25 * <p>This interface can either be instantiated directly or implemented by a class. 26 * If you instantiate it directly you must overwrite the event methods with 27 * anonymous function. 28 * 29 * <p>Note that overwriting the event method with a anonymous function is error-prone, 30 * because the arguments' types and the return type are not type-checked. Instantiating 31 * an interface directly is also not permitted in Flex. 32 * 33 * <code> 34 * var listener:MethodInvocationErrorListener = new MethodInvocationErrorListener(); 35 * listener.onError = function(errorInfo:MethodInvocationErrorInfo):Void { 36 * trace("Error occured when trying to invoke the method: " + errorInfo); 37 * } 38 * </code> 39 * 40 * <p>Implementing the interface by a class is a much neater way, but sometimes adds 41 * unnecessary complexity. 42 * 43 * <code> 44 * class MyListener implements MethodInvocationErrorListener { 45 * public function onError(errorInfo:MethodInvocationErrorInfo):Void { 46 * trace("Error occured when trying to invoke the method: " + errorInfo); 47 * } 48 * } 49 * </code> 50 * 51 * @author Simon Wacker 52 */ 53 interface org.as2lib.io.conn.core.event.MethodInvocationErrorListener { 54 55 /** 56 * Is executed when a method invocation fails. 57 * 58 * <p>Known issues are: 59 * <ul> 60 * <li>The method threw an exception.</li> 61 * <li>The method does not exist on the remote service.</li> 62 * </ul> 63 * 64 * <p>Remember that not all clients support this functionalities. 65 * 66 * @param errorInfo contains information about the error and some useful information 67 * about the called method 68 */ 69 public function onError(errorInfo:MethodInvocationErrorInfo):Void; 70 71 }