public final class ServiceException extends RequestFailureException
This exception corresponds to any failure code starting with "Service".
You can interrogate the
isDueToXXX()
methods of this exception to find out more
about the cause. But do note that it is possible for none of those methods to
return true
if a relevant new failure code is added into the
API. Be prepared for this in your handling.
Modifier and Type | Method and Description |
---|---|
boolean |
isDueToServiceTemporarilyDown()
Returns
true if this failure was caused by a temporary
problem preventing the API service from functioning properly (sorry!). |
boolean |
isDueToServiceUnexpectedError()
Returns
true if this failure was caused by a unexpected
error in the API service (sorry!). |
responseMetadata
failure, getMessage
public boolean isDueToServiceTemporarilyDown()
true
if this failure was caused by a temporary
problem preventing the API service from functioning properly (sorry!).
This might, for example, be caused by a temporary network error preventing our API servers from accessing the database of weather data that the calculation process relies upon. Or it could be caused by other essential systems being overloaded.
The best way to handle this type of failure is usually to try the request again until it works (waiting a little while between repeated submissions). If you get this type of failure for one request, it is quite likely that some or all of your requests will fail in the same way until the problem is resolved (which hopefully won't take long).
isDueToXXX()
methodspublic boolean isDueToServiceUnexpectedError()
true
if this failure was caused by a unexpected
error in the API service (sorry!).
If an unexpected error in the API service should occur, it is quite likely that it would only be triggered by a specific request (e.g. a request for data from a particular weather station). This is different to the service going temporarily down and affecting most or all requests until the problem is resolved.
If a request triggers a "ServiceUnexpectedError" failure, there probably won't be any point in trying that particular request repeatedly. Other requests will probably continue to work OK, but the problem request, if repeatedly submitted, will probably repeatedly fail until the underlying bug in the system is addressed. This is the sort of thing that would typically take at least a day or two, or potentially much longer (some bugs are beyond our sphere of control).
If you're getting this type of failure repeatedly, and it's getting in the way of what you're trying to achieve with the API, please email us to let us know. Our logging system should alert us each time an error like this occurs, but it's always useful to hear more information. Also, if it's not something we can fix on our end, we might well be able to suggest some sort of workaround.
isDueToXXX()
methods
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.