Skip to content
ardliath edited this page Sep 15, 2014 · 6 revisions

We've taken great care to ensure that exceptions we throw are useful and meaningful allowing developers to handle them with ease.

All exceptions thrown by the library should inherit from ViewRangerException. The only exception to this is when configuration errors are thrown by the constructor. These will be of type ConfigurationErrorsException.

There most common types you will see are:

ClientException

This error occurs when there was a problem within the API library. Check the InnerException for full details of what went wrong. We don't like to see this exception being thrown, if you do see it please Raise An Issue.

UserNotSpecifiedException

This exception is thrown when a request is made without setting the user's Username and PIN. The ForUser() method should always be caller prior requesting information from ViewRanger.

UnexpectedResponseException

This exception occurs when the API downloads data from ViewRanger which it cannot parse. We don't like to see this exception being thrown, if you do see it please Raise An Issue.

FailedRequestException

These exceptions are errors which are returned to us from ViewRanger. For convenience they are split into several child classes.

ApiKeyRejectedException

This exception is thrown when ViewRanger rejected the request because the API key was invalid. The common reasons for this are:

  • 1 - Invalid API key
  • 2 - API key is not enabled
  • 3 - API call requested from an incorrect domain
  • 5 - You have reached the usage limit for this service in this period of time

Check the ViewRangerCode and ViewRangerMessage to determine exactly why your request failed.

InternalViewRangerException

This exception is thrown when we receive an error code of 6 from the API, something went wrong at ViewRanger's end. You should contact their customer support team.

InvalidUserCredentialsException

You will get this exception when the API key was valid but the credentials were incorrect for the user who's details you were trying to access. The common reasons for this are:

  • 10 - The PIN does not match with the username
  • 11 - Username does not exist

Check the ViewRangerCode and ViewRangerMessage to determine exactly why your request failed.

MalformedRequestException

This exception is thrown when ViewRanger rejected the parameters you sent in your query. The most common causes for this are:

  • 4 - Invalid service
  • 8 - Invalid date specified
  • 9 - Invalid limit specified

Check the ViewRangerCode and ViewRangerMessage to determine exactly why your request failed.

Usually you will receive this exception because either the limit value (1-500) or date range is invalid. It is also possible you could get this from a error code 4 (Invalid Service). If this is the case it's most likely an undiagnosed issue with the API Library so please Raise An Issue so we can resolve it.

Clone this wiki locally