Skip to content

Latest commit

 

History

History
80 lines (70 loc) · 3.18 KB

File metadata and controls

80 lines (70 loc) · 3.18 KB
title Use the Detail property to handle specific errors
description Learn how access the inner text of the Message child element by using the Detail property to handle specific errors.
ms.date 09/25/2024
ms.service reporting-services
ms.subservice report-server-web-service
ms.topic reference
ms.custom
updatefrequency5
helpviewer_keywords
exceptions [Reporting Services], Detail property
Detail property
InnerText property

Use the Detail property to handle specific errors

To further classify exceptions, [!INCLUDEssRSnoversion] returns other error information in the InnerText property of the child elements in the SOAP exception's Detail property. Because the Detail property is an XmlNode object, you can access the inner text of the Message child element using the following code.

For a list of all of the available child elements contained in the Detail property, see Detail Property. For more information, see "Detail Property" in the [!INCLUDEmsCoName] [!INCLUDEdnprdnshort] 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  
   }  
}  

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);  

Related content