Detail 속성을 사용하여 특정 오류 처리Using the Detail Property to Handle Specific Errors

예외를 상세하게 분류하기 위해 Reporting ServicesReporting Services는 SOAP 예외의 Detail 속성에서 자식 요소의 InnerText 속성으로 추가 오류 정보를 반환합니다.To further classify exceptions, Reporting ServicesReporting Services returns additional error information in the InnerText property of the child elements in the SOAP exception's Detail property. Detail 속성은 XmlNode 개체이므로 다음 코드를 사용하여 Message 자식 요소의 내부 텍스트에 액세스할 수 있습니다.Because the Detail property is an XmlNode object, you can access the inner text of the Message child element using the following code.

Detail 속성에 포함된 사용 가능한 모든 자식 요소 목록은 Detail 속성을 참조하세요.For a list of all of the available child elements contained in the Detail property, see Detail Property. 자세한 내용은 MicrosoftMicrosoft .NET Framework.NET Framework SDK 설명서의 "Detail 속성(Detail Property)"을 참조하세요.For more information, see "Detail Property" in the MicrosoftMicrosoft .NET Framework.NET Framework SDK documentation.

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 예외로 콘솔에 반환되는 특정 오류 코드를 작성합니다.The following line of code writes the specific error code being returned in the SOAP Exception to the console. 오류 코드를 평가하고 특정 동작을 수행할 수도 있습니다.You could also evaluate the error code and perform specific actions.

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

관련 항목:See Also

Reporting Services의 예외 처리 소개 Introducing Exception Handling in Reporting Services
Reporting Services SoapException 클래스 Reporting Services SoapException Class
SoapException 오류 테이블SoapException Errors Table