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.env.except.FatalException; 18 19 /** 20 * {@code IllegalStateException} signals that a method has been invoked at an 21 * illegal or inappropriate time. 22 * 23 * @author Simon Wacker 24 */ 25 class org.as2lib.env.except.IllegalStateException extends FatalException { 26 27 /** 28 * Constructs a new {@code IllegalStateException} instance. 29 * 30 * <p>All arguments are allowed to be {@code null} or {@code undefined}. But 31 * if one is, the string representation returned by the {@code toString} 32 * method will not be complete. 33 * 34 * <p>The {@code args} array should be the internal arguments array of the 35 * method that throws the throwable. The internal arguments array exists in 36 * every method and contains its parameters, the callee method and the caller 37 * method. You can refernce it in every method using the name 38 * {@code "arguments"}. 39 * 40 * @param message the message that describes the problem in detail 41 * @param thrower the object that declares the method that throws this fatal 42 * exception 43 * @param args the arguments of the throwing method 44 */ 45 public function IllegalStateException(message:String, thrower, args:Array) { 46 // extending does not work if IllegalArgumentException is also imported, 47 // because it is loaded first and needs IllegalStateException itself, which 48 // also needs IllegalArgumentException. You see the cycle, don't you? 49 this.__proto__.__proto__ = FatalException.prototype; 50 this.message = message; 51 this.stackTrace = new Array(); 52 addStackTraceElement(thrower, args.callee, args); 53 } 54 55 }