Examples of RequestFailedException


Examples of com.heroku.api.exception.RequestFailedException

        if (status == Http.Status.OK.statusCode) {
            return Unit.unit;
        } else if (status == Http.Status.FORBIDDEN.statusCode) {
            throw HttpUtil.insufficientPrivileges(status, bytes);
        } else {
            throw new RequestFailedException("Error occurred while scaling.", status, bytes);
        }
    }
View Full Code Here

Examples of com.quantcomponents.core.exceptions.RequestFailedException

  @Override
  public List<IContract> searchContracts(IContract criteria, ITaskMonitor taskMonitor) throws ConnectException, RequestFailedException {
    String symbol = criteria.getSymbol();
    if (symbol == null || symbol.trim().length() == 0) {
      throw new RequestFailedException("Symbol must be speficied for Yahoo! Finance ticker query");
    }
    String quotedSymbol;
    try {
      quotedSymbol = URLEncoder.encode(symbol, URL_ENCODING_ENCODING);
    } catch (UnsupportedEncodingException e) {
      throw new RequestFailedException("Exception encoding symbol: " + symbol, e);
    }
    String queryUrl = String.format(YAHOO_TICKER_QUERY_URL, quotedSymbol);
    logger.log(Level.INFO, "Query Yahoo!Finance for tickers: " + queryUrl);
    JSON response = null;
    try {
      String responseString = httpQuery(queryUrl);
      String jsonResponse = responseString.replace("YAHOO.Finance.SymbolSuggest.ssCallback(", "").replace(")","");
      Reader responseReader = new StringReader(jsonResponse);
      logger.log(Level.FINE, "Response from Yahoo!Finance: " + jsonResponse);
      response = JSON.parse(responseReader);
    } catch (IOException e) {
      throw new ConnectException("Exception while connecting to: " + queryUrl + " [" + e.getMessage() + "]");
    } catch (JSONException e) {
      throw new RequestFailedException("Exception parsing response data from: " + queryUrl, e);
    }
    @SuppressWarnings("unchecked")
    List<JSON> securityList = (List<JSON>) response.get("ResultSet").get("Result").getValue();
    List<IContract> contractList = new LinkedList<IContract>();
    for (JSON security : securityList) {
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.