Click or drag to resize

FailureException Class

Superclass of exceptions that indicate a Failure in the API's processing of all or part of a request.
Inheritance Hierarchy

Namespace: DegreeDays.Api
Assembly: DegreeDays (in DegreeDays.dll) Version: 1.4
Syntax
public abstract class FailureException : DegreeDaysApiException

The FailureException type exposes the following members.

Properties
 NameDescription
Public propertyFailure Gets the non-null Failure object containing details of the failure on the API's servers that led to this exception on the client.
Public propertyMessage Overridden to return the Failure details as the exception message.
(Overrides ExceptionMessage)
Top
Remarks

Apart from TransportException, all subclasses of DegreeDaysApiException are subclasses of FailureException, and carry a coded Failure which originates from the server-side processing of an API request.

Most types of FailureException extend RequestFailureException, which indicates that the API servers completely failed to process an API request (sending back only a Failure as their response). But a failure doesn't have to relate to a full request - it is possible for parts of a request to work and parts to fail. Right now the only example of this is SourceDataException which indicates that the API servers failed to generate a specific set of data as part of a batch request.

IsDueToXXX properties on subclasses of FailureException

Some of the subclasses of FailureException have IsDueToXXX-style properties. These work by inspecting the Code of the Failure object that the exception carries.

The IsDueToXXX properties follow a simple pattern: they will always return true if the failure code starts with the XXX part of the property name. So, for example, IsDueToServiceTemporarilyDown will return true if the code is "ServiceTemporarilyDown" or "ServiceTemporarilyDownForPostalCodeLookups" (a failure code that isn't actually in use at the time of writing, but that may come into use at some point in the future).

If you're checking IsDueToXXX properties, bear in mind that it's possible for none of them to return true. This client library doesn't expose all possible failure codes through the IsDueToXXX properties, only the ones that are likely to arise through use of the client library, and only the ones that were defined at the time this version of the client library was released. New codes may be added into the API over time, and they shouldn't cause incompaiblities with code that you've already written to test the existing IsDueToXXX properties.

In a nutshell: when writing code that tests IsDueToXXX properties (e.g. to decide what message to show in a UI), make sure that your code will work well if none of those methods return true.

This abstract class is not designed to be extended by third-party code, which is why it does not have an accessible constructor.

See Also