Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net catch Xero exceptions

Hi.  I am using the following code to catch errors in the Xero API.The following has the ValidationException, but there are other exceptions like .APIException and .BadRequestException
How do I get the information on Exceptions if there are more than one of these types of Exception?      

Catch ex As Xero.Api.Infrastructure.Exceptions.ValidationException

            For Each v In ex.ValidationErrors
                System.Diagnostics.Debug.WriteLine(v.Message)
                oValidationErrors = oValidationErrors & " " & v.Message
            Next
            Response.Write("Error Line Details " & oValidationErrors)

        End Try
Avatar of ste5an
ste5an
Flag of Germany image

Check whether all these exceptions have a base exception you can catch. Otherwise you need to what we all have to do in such a scenario: Catch them all explicitly, thus a catch clause for each of them.
Avatar of Murray Brown

ASKER

Thanks can you have multiple catch clauses for one Try
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great! Thanks very much