오류 검사 및 유효성 검증

Rational® ClearQuest® API의 많은 메소드 및 특성에 대해 리턴값을 검사하여 호출이 오류를 리턴하는지 여부를 유효성 검증해야 합니다.

잠재적 예외로 인한 장애를 처리할 코드도 작성해야 합니다. Perl의 경우, eval{}문 내에서 API 메소드를 실행하여 예외를 트랩하십시오. 예를 들어, 다음과 같습니다.
# trap exceptions and error message strings
# ...
    eval { $RetVal = ${$CQEntity}->Validate(); };
    # EXCEPTION information is in $@
    # RetVal is either an empty string or contains a failure message string
    if ($@){
		print "Exception: '$@'\n";
		# other exception handling goes here...
	   }
    if ($RetVal eq "")
         {# success...
         }
    else {
	  	  # failure...
	  	  # return the message string  here...
	 }

VBScript의 경우, On Error문을 사용하여 예외를 트랩하십시오. 자세한 정보는 VBScript 오류 처리Perl 오류 처리를 참조하십시오. 조치 커미트 후크 예제Commit 메소드를 호출할 때 발생하는 오류 및 예외 처리 예제가 제공되어 있습니다.


피드백