This page was saved using jaction on 2006-09-04 8:33:39.
Address: http://flexdocs.kr/docs/flex2/langref/Error.html
Title: Error (Flex™ 2 레퍼런스 가이드)  •  Size: 29996
Package톱 레벨
Classpublic dynamic class Error
InheritanceError Inheritance Object
SubclassesArgumentError , CollectionViewError , CursorError , DataListError , DataServiceError , DefinitionError , EvalError , Fault , IllegalOperationError , InvalidCategoryError , InvalidFilterError , InvalidSWFError , IOError , ItemPendingError , MemoryError , MessagingError , NoDataAvailableError , RangeError , ReferenceError , ScriptTimeoutError , SecurityError , SortError , StackOverflowError , SyntaxError , TypeError , UnresolvedConflictsError , URIError , VerifyError , VideoError

Error 클래스에는, 스크립트로 발생한 에러에 관한 정보가 포함되어 있습니다. ActionScript 3.0 어플리케이션의 개발에 대해, 컴파일 된 코드를 Flash Player 의 디버그판으로 실행하면, Error 형 또는 서브 클래스의 예외가 다이알로그 박스에 표시되기 (위해)때문에, 코드의 문제 해결에 도움이 됩니다. Error object를 작성하려면 ,Error constructor    함수를 사용합니다. 일반적으로는,try 코드 블록내로부터 새로운 Error object를 슬로우 합니다. 그리고,catch 코드 블록 또는 finally 코드 블록으로 이것을 캐치 합니다.

Error 클래스의 서브 클래스를 작성해, 그 클래스의 인스턴스를 슬로우 할 수도 있습니다.

View the examples

See also

디버그판의 Flash Player 의 조작
독자적인 에러 클래스의 작성
에러 이벤트에의 응답과 스테이터스


Public property
 property정의
 Inheritedconstructor : Object
특정의 object 인스턴스의 클래스 object 또는 constructor    함수에의 참조입니다.
Object
  errorID : int
[read-only] 특정의 에러 메세지에 관련지을 수 있었던 참조 번호입니다.
Error
  message : String
Error object에 관련지을 수 있었던 메세지입니다.
Error
  name : String
Error object의 이름입니다.
Error
 Inheritedprototype : Object
[static] 클래스 또는 함수 object의 prototype object에의 참조입니다.
Object
Public Methods
 Methods정의
  Error (message:String = "", id:int = 0)
새로운 Error object를 작성합니다.
Error
  getStackTrace ():String
에러의 구축시에 에러의 호출 스택을 string로 돌려줍니다 (디버거 버젼의 Flash Player 전용).
Error
 InheritedhasOwnProperty (name:String ):Boolean
object로 지정된 property가 정의되고 있는지 어떤지를 나타냅니다.
Object
 InheritedisPrototypeOf (theClass:Object ):Boolean
Object 클래스의 인스턴스가, Parameters로서 지정된 object의 prototype 체인내에 있을지 어떨지를 나타냅니다.
Object
 InheritedpropertyIsEnumerable (name:String ):Boolean
지정된 property가 존재해, 열거 가능한가 어떤가를 나타냅니다.
Object
 InheritedsetPropertyIsEnumerable (name:String , isEnum:Boolean = true):void
루프 처리에 대한 다이나믹 property의 가용성을 설정합니다.
Object
  toString ():String
디폴트에서는 "Error" 라고 하는 string를 돌려줍니다. Error.message property가 정의되고 있는 경우는, 그 값을 돌려줍니다.
Error
 InheritedvalueOf ():Object
지정된 object의 원시적치를 돌려줍니다.
Object
property의 상세
errorIDproperty
errorID:int   [read-only]

특정의 에러 메세지에 관련지을 수 있었던 참조 번호입니다. custom Error object의 경우, 이 번호는 constructor    으로 제공되는 id Parameters의 값입니다.

Implements
    public function get errorID():int
messageproperty 
public var message:String

Error object에 관련지을 수 있었던 메세지입니다. 디폴트에서는, 이 property의 값은 "Error" 입니다. Error object를 작성할 때에,Error constructor    함수에 에러 string를 건네주는 것으로 message property를 지정할 수 있습니다.

See also

nameproperty 
public var name:String

Error object의 이름입니다. 디폴트에서는, 이 property의 값은 "Error" 입니다.

See also

constructor    의 상세
Error()constructor   
public 함수 Error(message:String = "", id:int = 0)

새로운 Error object를 작성합니다. message 를 지정했을 경우는, 그 값이 object의 Error.message property에 할당할 수 있습니다.

Parameters
message:String (default = "") — Error object에 관련지을 수 있었던 string. 이 Parameters는 옵션입니다.
 
id:int (default = 0) — 특정의 에러 메세지에 관련짓는 참조 번호입니다.

See also


Example
다음의 예에서는, 새로운 Error object err 를 작성해, 다음에,Error() constructor    을 사용해, string "New Error Message"err.

var err:Error = new Error();
trace(err.toString());    // Error

err = new Error("New Error Message");
trace(err.toString());    // Error: New Error Message

Methods의 상세
getStackTrace()Methods
public function getStackTrace():String

에러의 구축시에 에러의 호출 스택을 string로 돌려줍니다 (디버거 버젼의 Flash Player 전용). 다음의 예에 나타나고 있도록(듯이), 반환값의 선두행은, 예외 object의 string 표현으로, 그 후에는 스택 트레이스 엘리먼트가 계속됩니다.

  TypeError: null cannot be converted to an object
      at com.xyz.OrderEntry.retrieveData(OrderEntry.as:995)
      at com.xyz.OrderEntry.init(OrderEntry.as:200)
      at com.xyz.OrderEntry. $construct(OrderEntry.as:148)
     

반환값
String — 호출 스택의 string 표현입니다.
toString()Methods 
public override function toString():String

디폴트에서는 "Error" 라고 하는 string를 돌려줍니다. Error.message property가 정의되고 있는 경우는, 그 값을 돌려줍니다.

반환값
String — 에러 메세지입니다.

See also


Example
다음의 예에서는, 새로운 Error object err 를 작성해, 다음에,Error() constructor    을 사용해, string "New Error Message"err 에 할당합니다. 마지막으로,message property를 "Another New Error Message" 로 설정해, "New Error Message" 를 덧쓰기합니다.

var err:Error = new Error();
trace(err.toString());    // Error

err = new Error("New Error Message");
trace(err.toString());    // Error: New Error Message

err.message = "Another New Error Message";
trace(err.toString());    // Error: Another New Error Message

Examples

다음의 예에서는,ErrorExample 클래스를 사용해, custom 에러를 생성하는 방법을 나타냅니다. 여기에서는 다음의 순서를 실행합니다.
  1. Array 형의 로컬 변수 nullArray 를 선언합니다만, 새로운 Array object는 작성되지 않습니다.
  2. constructor    은, 에러 처리 code segment내에서 push() Methods를 사용해, 초기화되어 있지 않은 배열에 값을 로드하려고 합니다. 이 에러 처리 세그먼트(segment)는,Error 의 확장인 CustomError 클래스를 사용해 custom 에러를 캐치 합니다.
  3. CustomError 가 슬로우 되면, constructor    은 이것을 캐치 해, trace() 명령문(statement)를 사용해 에러 메세지를 출력합니다.
package
{
    import flash.display.Sprite;
    public class ErrorExample extends Sprite 
    {
        private var nullArray:Array;
        public function ErrorExample() 
        {
            try 
            {
                nullArray.push("item");
            }
            catch(e:Error) 
            {
                throw new CustomError("nullArray is null");
            }
        }
    }
}

class CustomError extends Error 
{
    public function CustomError(message:String) 
    {
        super(message);
    }
}






 

코멘트가 추가되었을 경우, 메일로 받기. | 코멘트 리포트

현재의 페이지: http://flexdocs.kr/docs/flex2/langref/Error.html