1  /**
     2   * com.sekati.except.Throwable
     3   * @version 1.1.0
     4   * @author jason m horwitz | sekati.com
     5   * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
     6   * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
     7   */
     8  
     9  import com.sekati.except.IThrowable;
    10  import com.sekati.log.Logger;
    11  import com.sekati.reflect.Stringifier;
    12  
    13  /**
    14   * Abstract Throwable mixin class for {@link com.sekati.except.Exception} classes.
    15   */
    16  class com.sekati.except.Throwable extends Error implements IThrowable {
    17  
    18  	private var type:String = "error";
    19  	private var name:String = "Throwable Error";
    20  	private var message:String;
    21  	private var _errorCode:String;
    22  	private var _stack:Array;
    23  	private var _thrower:Object;	
    24  
    25  	/**
    26  	 * Throwable Private Constructor
    27  	 * @param errorCode (String)
    28  	 * @param thrower (Object)
    29  	 * @param stack (Array)
    30  	 * @return Void
    31  	 */
    32  	private function Throwable(thrower:Object, errorCode:String, stack:Array) {
    33  		message = "@@@ " + name + " ['" + thrower + "']: " + errorCode;
    34  		Logger.$[type]( Stringifier.stringify( this ), this );	
    35  		_errorCode = errorCode;
    36  		_thrower = thrower;
    37  		_stack = stack;
    38  	}
    39  
    40  	/**
    41  	 * Return the localized error code message.
    42  	 * @return String
    43  	 */
    44  	public function getErrorCode():String {
    45  		return _errorCode;	
    46  	}	
    47  
    48  	/**
    49  	 * Return the error thrower.
    50  	 * @return Object
    51  	 */
    52  	public function getThrower():Object {
    53  		return _thrower;	
    54  	}
    55  
    56  	/**
    57  	 * Return the thrower argument stack
    58  	 * that generated the error.
    59  	 * @return Array
    60  	 */
    61  	public function getStack():Array {
    62  		return _stack;
    63  	}
    64  
    65  	/**
    66  	 * Return the {@link com.sekati.log.Logger} level type.
    67  	 * @return String
    68  	 */
    69  	public function getType():String {
    70  		return type;	
    71  	}
    72  
    73  	/**
    74  	 * Return the Throwable Exception name.
    75  	 * @return String
    76  	 */
    77  	public function getName():String {
    78  		return name;	
    79  	}
    80  }