Examples of UpdateFailedException


Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

            System.out.println("MOVES: guestId=" + updateInfo.getGuestId() + ", UPDATE FAILED (don't know why)");

            // The update failed.  We don't know if this is permanent or temporary.
            // Throw the appropriate exception.
            throw new UpdateFailedException(e);
        }

    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

            System.out.println("MOVES: guestId=" + updateInfo.getGuestId() + ", UPDATE FAILED (don't know why)");

            // The update failed.  We don't know if this is permanent or temporary.
            // Throw the appropriate exception.
            throw new UpdateFailedException(e);
        }
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                               e.getHttpResponseCode(), e.getHttpResponseMessage());

            // The update failed.  We don't know if this is permanent or temporary but
            // let's assume that it is permanent if it's our fault (4xx)
            if (e.getHttpResponseCode()>=400&&e.getHttpResponseCode()<500)
                throw new UpdateFailedException("Unexpected response code: " + e.getHttpResponseCode(), new Exception(), true,
                                                ApiKey.PermanentFailReason.clientError(e.getHttpResponseCode(), e.getHttpResponseMessage()));
            throw new UpdateFailedException(e);
        } catch (RateLimitReachedException e) {
            // Couldn't fetch storyline, rate limit reached
            countFailedApiCall(updateInfo.apiKey, updateInfo.objectTypes, then, fetchUrl, Utils.stackTrace(e),
                               429, "Rate limit reached");

            // Rethrow the rate limit reached exception
            throw e;


        } catch (IOException e) {
            countFailedApiCall(updateInfo.apiKey, updateInfo.objectTypes, then, fetchUrl, Utils.stackTrace(e), -1, "I/O");

            // The update failed.  We don't know if this is permanent or temporary.
            // Throw the appropriate exception.
            throw new UpdateFailedException(e);
        }
        return fetched;
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                                                              "Please head to <a href=\"javascript:App.manageConnectors()\">Manage Connectors</a>,<br>" +
                                                              "scroll to the Moves connector, and renew your tokens (look for the <i class=\"icon-resize-small icon-large\"></i> icon)");
                    // Record permanent failure since this connector won't work again until
                    // it is reauthenticated
                    guestService.setApiKeyStatus(updateInfo.apiKey.getId(), ApiKey.Status.STATUS_PERMANENT_FAILURE, null, ApiKey.PermanentFailReason.NEEDS_REAUTH);
                    throw new UpdateFailedException("Unauthorized access", true, ApiKey.PermanentFailReason.NEEDS_REAUTH);
                }
                else if(statusCode == 429) {
                    // Over quota, so this API attempt didn't work
                    // Set the reset time info in updateInfo so that we get scheduled for when the quota becomes available
                    updateInfo.setResetTime("moves", getQuotaAvailableTime());
                    throw new RateLimitReachedException();
                }
                else if (statusCode>=400 && statusCode<500) {
                    String message40x = "Unexpected response code: " + statusCode;
                    if (message!=null) message40x += " message: " + message;
                    throw new UpdateFailedException(message40x, new Exception(), true, ApiKey.PermanentFailReason.clientError(statusCode, message));
                }
                else {
                    throw new UnexpectedHttpResponseCodeException(response.getStatusLine().getStatusCode(),
                                                                  response.getStatusLine().getReasonPhrase());
                }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                    .append(" stackTrace=<![CDATA[").append(Utils.stackTrace(e)).append("]]>");;
            logger.info(sb.toString());

            // The update failed.  We don't know if this is permanent or temporary.
            // Throw the appropriate exception.
            throw new UpdateFailedException(e);
        }
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

                    .append(" stackTrace=<![CDATA[").append(Utils.stackTrace(e)).append("]]>");;
            logger.info(sb.toString());

            // The update failed.  We don't know if this is permanent or temporary.
            // Throw the appropriate exception.
            throw new UpdateFailedException(e);
        }
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

        final String json = HttpUtils.fetch("https://jawbone.com/auth/oauth2/token", parameters);

        JSONObject token = JSONObject.fromObject(json);
        if (!token.has("access_token")) {
            final String message = "Couldn't renew access token (no \"access_token\" field in JSON response)";
            throw new UpdateFailedException(message, new Exception(), true, ApiKey.PermanentFailReason.unknownReason(message));
        }
        final String accessToken = token.getString("access_token");
        // store the new secret
        guestService.setApiKeyAttribute(updateInfo.apiKey,
                "jawboneUp.client.secret", env.get("jawboneUp.client.secret"));
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

            JSONObject errorJson = JSONObject.fromObject(content);
            if (errorJson.has("meta")) {
                JSONObject meta = errorJson.getJSONObject("meta");
                if (meta.has("error_type")) {
                    String details = meta.has("error_detail") ? meta.getString("error_details") : "Unknown Error (no details provided)";
                    throw new UpdateFailedException(message + " - " + details, true, ApiKey.PermanentFailReason.unknownReason(details));
                }
            }
        } catch (Throwable t) {
            // just ignore any potential problems here
        }
        if (statusCode==401)
            throw new AuthExpiredException();
        if (statusCode>=400&&statusCode<500) {
            throw new UpdateFailedException("Unexpected response code: " + statusCode, new Exception(), true,
                                            ApiKey.PermanentFailReason.clientError(statusCode, message));
        } else
            throw new UpdateFailedException("Unexpected response code: " + statusCode);
    }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

            countFailedApiCall(updateInfo.apiKey, updateInfo.objectTypes, then, requestUrl, reasonPhrase,
                               statusCode, reasonPhrase);
            if (statusCode==401)
                throw new AuthExpiredException();
            else if (statusCode>=400&&statusCode<500)
                throw new UpdateFailedException("Unexpected response code " + statusCode, new Exception(), true,
                                                ApiKey.PermanentFailReason.clientError(statusCode, reasonPhrase));
            throw new UpdateFailedException(new Exception());
    }
  }
View Full Code Here

Examples of org.fluxtream.core.connectors.updaters.UpdateFailedException

          updateInfo.objectTypes, then, requestUrl, reasonPhrase,
                    statusCode, reasonPhrase);
            if (statusCode==401)
                throw new AuthExpiredException();
            else if (statusCode>=400&&statusCode<500)
                throw new UpdateFailedException("Unexpected response code " + statusCode, new Exception(), true,
                                                ApiKey.PermanentFailReason.clientError(statusCode, reasonPhrase));
            throw new UpdateFailedException(new Exception());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.