Handling Warnings and Cases That Do Not Cause Exceptions

Reporting Services does not throw exceptions for warnings and certain errors. For example, when you use the CreateCatalogItem method to publish a new report to a report server, any warnings that occur are returned as an array of Warning objects. These warnings should be handled and displayed so that appropriate action can be taken.

   rs.CreateCatalogItem(name, parentFolder, False, definition, Nothing, warnings)

   If Not (warnings.Length = 0) Then
      Dim warning As Warning
      For Each warning In warnings
      Next warning
      Console.WriteLine("Report {0} created successfully with no warnings", name)
   End If

Catch ex As SoapException
End Try
   rs.CreateCatalogItem("Report", name, parentFolder, false, definition, null, out warnings);

   if (warnings.Length != 0)
      foreach (Warning warning in warnings)
      Console.WriteLine("Report {0} created successfully with no warnings", name);

catch (SoapException ex)

Another way to handle errors is to evaluate the return values of certain methods. For example, the FindItems method can be used to search for specific items in the report server database. If no items are found that match the search criteria, a null array of CatalogItem objects is returned. You should evaluate the array, check for null, and let the user know if no items were found.