Detail 속성을 사용하여 특정 오류 처리

예외를 추가로 분류하기 위해 Reporting Services는 SOAP 예외의 Detail 속성에 있는 자식 요소의 InnerText 속성에 다른 오류 정보를 반환합니다. Detail 속성은 XmlNode 개체이므로 다음 코드를 사용하여 Message 자식 요소의 내부 텍스트에 액세스할 수 있습니다.

Detail 속성에 포함된 사용 가능한 모든 자식 요소 목록은 Detail 속성을 참조하세요. 자세한 내용은 Microsoft .NET Framework SDK 설명서의 "Detail Property"를 참조하세요.

Try  
' Code for accessing the report server  
Catch ex As SoapException  
   ' The exception is a SOAP exception, so use  
   ' the Detail property's Message element.  
   Console.WriteLine(ex.Detail("Message").InnerXml)  
End Try  
try  
{  
   // Code for accessing the report server  
}  
catch (SoapException ex)  
{  
   // The exception is a SOAP exception, so use  
   // the Detail property's Message element.  
   Console.WriteLine(ex.Detail["Message"].InnerXml);  
}  
Try  
' Code for accessing the report server  
Catch ex As SoapException  
   If ex.Detail("ErrorCode").InnerXml = "rsInvalidItemName" Then  
   End If ' Perform an action based on the specific error code  
End Try  
try  
{  
   // Code for accessing the report server  
}  
catch (SoapException ex)  
{  
   if (ex.Detail["ErrorCode"].InnerXml == "rsInvalidItemName")  
   {  
      // Perform an action based on the specific error code  
   }  
}  

다음 코드 줄은 SOAP 예외로 콘솔에 반환되는 특정 오류 코드를 작성합니다. 오류 코드를 평가하고 특정 동작을 수행할 수도 있습니다.

Console.WriteLine(ex.Detail("ErrorCode").InnerXml)  
Console.WriteLine(ex.Detail["ErrorCode"].InnerXml);  

Reporting Services의 예외 관리 소개
Reporting Services SoapException 클래스
SoapException 오류 테이블