views:

48

answers:

2

I am using the ReportServices Web Services API and I want to determine the exceptions that can be thrown by it.

Is there an easy way to do that?

+2  A: 

C# does not have exception specifiers like Java does, so the primary way to determine what exceptions a method throws is to look at the documentation and hope that the developers documented the possible exceptions.

Assuming you're talking about the SQL Server Reporting Services Web Service, it looks like their online API reference does mention exceptions. For example, for CreateSchedule it says:

This method throws an rsUnsupportedParameterForModeException exception if a non-null value is specified for the SiteUrl parameter in Native mode.

Alternatively, if you have lots of time, you can use Reflector to dig through the implementation of the API methods you call (and the methods they call, and so on...) to see what gets thrown.

Chris Schmich
A: 

Keep in mind that exceptions can still be raised due to internal errors. You can look up the documentation and have a look at the exceptions manually raised, but some NullReference or OutOfMemory can still occur. Getting an complete list will be quite painful.

Johann Blais