Click or drag to resize

FailureCode Property

Gets the non-null, non-empty code associated with this failure.

Namespace: DegreeDays.Api
Assembly: DegreeDays (in DegreeDays.dll) Version: 1.4
Syntax
public string Code { get; }

Property Value

String
Remarks

Every failure has a Code that indicates the cause of the failure.

These codes are named in a hierarchical way. For example, if a failure is caused by an invalid request, its code will begin with "InvalidRequest". The idea is that you can quickly test for broader types of failure code without having to know or itemize all the sub-types (like "InvalidRequestAccount" and "InvalidRequestSignature").

New codes may be added into the API at any time. New codes might be sub-types of existing types (like if "InvalidRequestSomeNewCode" was added as a sub-type of "InvalidRequest"), or they might be completely new (like "SomeCompletelyNewCode"). If you're writing logic that checks for different failure codes, make sure that it won't blow up if it comes across a code that it doesn't recognize. (Though note that you probably won't need to write such logic if you're making your API requests through DegreeDaysApi, since that will automatically wrap failures up into appropriate exceptions.)

You are unlikely to need to deal with failure codes directly, as API methods like GetLocationData(LocationDataRequest) and GetBase(DataSpec) will automatically turn any failure codes into appropriate subclasses of FailureException.

See Also