diff options
| author | rsudev <rasch@munin-soft.de> | 2014-02-22 23:03:45 +0100 |
|---|---|---|
| committer | rsudev <rasch@munin-soft.de> | 2014-02-22 23:03:45 +0100 |
| commit | c841050d5797082b5531e0ef9dc8e2dd5cba7386 (patch) | |
| tree | aa07fdf891a3bc946341c7beada1871f0d018820 /main/src/cgeo/geocaching/connector/oc/OkapiClient.java | |
| parent | 0fef0fb52b537065cfe3561628c58ad74b5336b3 (diff) | |
| download | cgeo-c841050d5797082b5531e0ef9dc8e2dd5cba7386.zip cgeo-c841050d5797082b5531e0ef9dc8e2dd5cba7386.tar.gz cgeo-c841050d5797082b5531e0ef9dc8e2dd5cba7386.tar.bz2 | |
Finally fixes #3267, Detect and report time-skew that prevents okapi access
Extended the OAuth process to allow specific additional error reporting
Diffstat (limited to 'main/src/cgeo/geocaching/connector/oc/OkapiClient.java')
| -rw-r--r-- | main/src/cgeo/geocaching/connector/oc/OkapiClient.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java index f4bac08..fbcda18 100644 --- a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java +++ b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java @@ -822,6 +822,21 @@ final class OkapiClient { } /** + * Retrieves error information from an unsuccessful Okapi-response + * + * @param response + * response containing an error object + * @return OkapiError object with detailed information + */ + public static OkapiError decodeErrorResponse(HttpResponse response) { + final JSONResult result = new JSONResult(response); + if (!result.isSuccess) { + return new OkapiError(result.data); + } + return new OkapiError(new JSONObject()); + } + + /** * Encapsulates response state and content of an HTTP-request that expects a JSON result. <code>isSuccess</code> is * only true, if the response state was success and <code>data</code> is not null. */ |
