Examples of AsanaException


Examples of com.capra.integration.asana.AsanaException

        try {
            httpRequest = requestFactory.buildGetRequest(genericUrl);
        } catch (IOException e) {
            String errorMessage = String.format("Build GET Request for URL <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        HttpResponse execute = null;

        try {
            execute = httpRequest.execute();
        } catch (UnknownHostException unknownHostException) {
            String errorMessage = String.format("Executing GET Request <%s> for unknown host. Possible reasons: 1. Typo in URL, 2. Not working internet connections", genericUrl.build());
            logger.error(errorMessage, unknownHostException);
            throw new AsanaException(errorMessage, unknownHostException);
        } catch (HttpResponseException httpResponseException) {
            int statusCode = httpResponseException.getStatusCode();
            String errorMessage = String.format("Executing GET Request <%s> fails with response status code <%s> and following message <%s>",
                    genericUrl.build(), String.valueOf(statusCode), httpResponseException.getMessage());
            // not found
            if (statusCode == 404) {
                return null;
            }
            logger.error(errorMessage, httpResponseException);
            throw new AsanaException(errorMessage, httpResponseException);
        } catch (IOException e) {
            String errorMessage = String.format("Executing GET Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        Object resultObject = null;
        try {
            resultObject = execute.parseAs(typeOfTeResult);
        } catch (IOException e) {
            String errorMessage = String.format("Parsing Response from GET Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        return prepareResult(resultObject, expectedResult);
    }
View Full Code Here

Examples of com.capra.integration.asana.AsanaException

        try {
            httpRequest = requestFactory.buildPostRequest(genericUrl, jsonHttpContent);
        } catch (IOException e) {
            String errorMessage = String.format("Building POST Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        HttpResponse response;
        try {
            response = httpRequest.execute();
        } catch (UnknownHostException unknownHostException) {
            String errorMessage = String.format("Executing POST Request <%s> for unknown host. Possible reasons: 1. Typo in URL, 2. Not working internet connections", genericUrl.build());
            logger.error(errorMessage, unknownHostException);
            throw new AsanaException(errorMessage, unknownHostException);
        } catch (IOException e) {
            String errorMessage = String.format("Executing POST Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        Object result;
        try {
            result = response.parseAs(typeOfTeResult);
        } catch (IOException e) {
            String errorMessage = String.format("Parsing Response from POST Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }
        return prepareResult(result, expectedResult);
    }
View Full Code Here

Examples of com.capra.integration.asana.AsanaException

        try {
            httpRequest = requestFactory.buildPutRequest(genericUrl, jsonHttpContent);
        } catch (IOException e) {
            String errorMessage = String.format("Building PUT Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        HttpResponse response;
        try {
            response = httpRequest.execute();
        } catch (UnknownHostException unknownHostException) {
            String errorMessage = String.format("Executing PUT Request <%s> for unknown host. Possible reasons: 1. Typo in URL, 2. Not working internet connections", genericUrl.build());
            logger.error(errorMessage, unknownHostException);
            throw new AsanaException(errorMessage, unknownHostException);
        } catch (IOException e) {
            String errorMessage = String.format("Executing PUT Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        Object result;
        try {
            result = response.parseAs(typeOfTeResult);
        } catch (IOException e) {
            String errorMessage = String.format("Parsing Response from PUT Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }
        return prepareResult(result, expectedResult);
    }
View Full Code Here

Examples of com.capra.integration.asana.AsanaException

        try {
            httpRequest = requestFactory.buildPostRequest(genericUrl, jsonHttpContent);
        } catch (IOException e) {
            String errorMessage = String.format("Building POST Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        try {
            httpRequest.execute();
        } catch (UnknownHostException unknownHostException) {
            String errorMessage = String.format("Executing POST Request <%s> for unknown host. Possible reasons: 1. Typo in URL, 2. Not working internet connections", genericUrl.build());
            logger.error(errorMessage, unknownHostException);
            throw new AsanaException(errorMessage, unknownHostException);
        } catch (IOException e) {
            String errorMessage = String.format("Executing POST Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }
    }
View Full Code Here

Examples of com.capra.integration.asana.AsanaException

        try {
            httpRequest = requestFactory.buildDeleteRequest(genericUrl);
        } catch (IOException e) {
            String errorMessage = String.format("Building DELETE Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }

        try {
            httpRequest.execute();
        } catch (UnknownHostException unknownHostException) {
            String errorMessage = String.format("Executing DELETE Request <%s> for unknown host. Possible reasons: 1. Typo in URL, 2. Not working internet connections", genericUrl.build());
            logger.error(errorMessage, unknownHostException);
            throw new AsanaException(errorMessage, unknownHostException);
        catch (IOException e) {
            String errorMessage = String.format("Executing DELETE Request <%s> fails, with following message <%s>", genericUrl.build(), e.getMessage());
            logger.error(errorMessage, e);
            throw new AsanaException(errorMessage, e);
        }
    }
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.