[jbosstools-issues] [JBoss JIRA] (JBIDE-13794) openshift-java-client: cannot get json response from exception

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Fri Mar 15 06:30:42 EDT 2013


     [ https://issues.jboss.org/browse/JBIDE-13794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andre Dietisheim updated JBIDE-13794:
-------------------------------------

    Description: 
With the change in JBIDE-13763, which implemented human readable exceptions that tell the user to what server the exception was occurring, we lost the ability to get the json from the exception. This is not ideal since the json contains the exact error message and error code from the server.
Before JBIDE-13763 *OpenShiftEndpointException* reported the server returned json as object when one called *OpenShiftEndpointException#getRestResponse*. OpenShiftEndpointException internally by getting the message from the HttpClientException it is wrapping:

{code:title=RestService#request}
		} catch (HttpClientException e) {
			throw new OpenShiftEndpointException(
					url.toString(), e, e.getMessage(),
					"Could not request {0}: {1}", url.toString(), getResponseMessage(e));
{code}

before JBIDE-13763: 
{code:title=HttpClientException.getMessage()}
{
   "data":null,
   "errors":{

   },
   "messages":[
      {
         "exit_code":128,
         "field":null,
         "severity":"error",
         "text":"Domain contains applications. Delete applications first or set force to true."
      }
   ],
   "status":"bad_request",
   "supported_api_versions":[
      1.0,
      1.1,
      1.2,
      1.3
   ],
   "type":null,
   "version":"1.0"
}
{code}

after JBIDE-13763:
{code:title=HttpClientException.getMessage()}
Connection to https://stg.openshift.redhat.com/broker/rest/domains/1363341069128, {
   "data":null,
   "errors":{

   },
   "messages":[
      {
         "exit_code":128,
         "field":null,
         "severity":"error",
         "text":"Domain contains applications. Delete applications first or set force to true."
      }
   ],
   "status":"bad_request",
   "supported_api_versions":[
      1.0,
      1.1,
      1.2,
      1.3
   ],
   "type":null,
   "version":"1.0"
}
{code}

When the user asks the OpenShiftEndpointException for the json from the server it would call OpenShiftEndpointException#getRestResponse() which would parse the message from json and return a RestResponse object.

  was:
With the change in JBIDE-13763, which implemented human readable exceptions that tell the user to what server the exception was occurring, we lost the ability to get the json from the exception. This is not ideal since the json contains the exact error message and error code from the server.
Before JBIDE-13763 *OpenShiftEndpointException* reported the server returned json as object when one called *OpenShiftEndpointException#getRestResponse*. OpenShiftEndpointException internally by getting the message from the HttpClientException it is wrapping:

{code:title=RestService#request}
		} catch (HttpClientException e) {
			throw new OpenShiftEndpointException(
					url.toString(), e, e.getMessage(),
					"Could not request {0}: {1}", url.toString(), getResponseMessage(e));
{code}

before JBIDE-13763: 
{code:title=HttpClientException.getMessage()}
{
   "data":null,
   "errors":{

   },
   "messages":[
      {
         "exit_code":128,
         "field":null,
         "severity":"error",
         "text":"Domain contains applications. Delete applications first or set force to true."
      }
   ],
   "status":"bad_request",
   "supported_api_versions":[
      1.0,
      1.1,
      1.2,
      1.3
   ],
   "type":null,
   "version":"1.0"
}
{code}

after JBIDE-13763:
{code:title=HttpClientException.getMessage()}
{code}
Connection to https://stg.openshift.redhat.com/broker/rest/domains/1363341069128, {
   "data":null,
   "errors":{

   },
   "messages":[
      {
         "exit_code":128,
         "field":null,
         "severity":"error",
         "text":"Domain contains applications. Delete applications first or set force to true."
      }
   ],
   "status":"bad_request",
   "supported_api_versions":[
      1.0,
      1.1,
      1.2,
      1.3
   ],
   "type":null,
   "version":"1.0"
}

When the user asks the OpenShiftEndpointException for the json from the server it would call OpenShiftEndpointException#getRestResponse() which would parse the message from json and return a RestResponse object.


    
> openshift-java-client: cannot get json response from exception
> --------------------------------------------------------------
>
>                 Key: JBIDE-13794
>                 URL: https://issues.jboss.org/browse/JBIDE-13794
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: openshift
>    Affects Versions: 4.1.0.Alpha2
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>             Fix For: 4.1.0.Alpha2
>
>
> With the change in JBIDE-13763, which implemented human readable exceptions that tell the user to what server the exception was occurring, we lost the ability to get the json from the exception. This is not ideal since the json contains the exact error message and error code from the server.
> Before JBIDE-13763 *OpenShiftEndpointException* reported the server returned json as object when one called *OpenShiftEndpointException#getRestResponse*. OpenShiftEndpointException internally by getting the message from the HttpClientException it is wrapping:
> {code:title=RestService#request}
> 		} catch (HttpClientException e) {
> 			throw new OpenShiftEndpointException(
> 					url.toString(), e, e.getMessage(),
> 					"Could not request {0}: {1}", url.toString(), getResponseMessage(e));
> {code}
> before JBIDE-13763: 
> {code:title=HttpClientException.getMessage()}
> {
>    "data":null,
>    "errors":{
>    },
>    "messages":[
>       {
>          "exit_code":128,
>          "field":null,
>          "severity":"error",
>          "text":"Domain contains applications. Delete applications first or set force to true."
>       }
>    ],
>    "status":"bad_request",
>    "supported_api_versions":[
>       1.0,
>       1.1,
>       1.2,
>       1.3
>    ],
>    "type":null,
>    "version":"1.0"
> }
> {code}
> after JBIDE-13763:
> {code:title=HttpClientException.getMessage()}
> Connection to https://stg.openshift.redhat.com/broker/rest/domains/1363341069128, {
>    "data":null,
>    "errors":{
>    },
>    "messages":[
>       {
>          "exit_code":128,
>          "field":null,
>          "severity":"error",
>          "text":"Domain contains applications. Delete applications first or set force to true."
>       }
>    ],
>    "status":"bad_request",
>    "supported_api_versions":[
>       1.0,
>       1.1,
>       1.2,
>       1.3
>    ],
>    "type":null,
>    "version":"1.0"
> }
> {code}
> When the user asks the OpenShiftEndpointException for the json from the server it would call OpenShiftEndpointException#getRestResponse() which would parse the message from json and return a RestResponse object.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list