diff --git a/gate-web/src/main/groovy/com/opsmx/spinnaker/gate/exception/RetrofitErrorHandler.groovy b/gate-web/src/main/groovy/com/opsmx/spinnaker/gate/exception/RetrofitErrorHandler.groovy index 217b1207b..29daf0984 100644 --- a/gate-web/src/main/groovy/com/opsmx/spinnaker/gate/exception/RetrofitErrorHandler.groovy +++ b/gate-web/src/main/groovy/com/opsmx/spinnaker/gate/exception/RetrofitErrorHandler.groovy @@ -43,15 +43,17 @@ class RetrofitErrorHandler { static final Gson gson = new Gson() - @ExceptionHandler([RetrofitError.class]) + @ExceptionHandler([RetrofitError.class, PipelineController.PipelineException.class]) @ResponseBody ResponseEntity handleRetrofitError(RetrofitError retrofitError){ if (retrofitError!=null){ - log.warn("Exception occurred in OES downstream services : {}", retrofitError.getMessage()) + log.warn("Exception occurred in OES downstream services : {}", retrofitError.getBody()) if (retrofitError.getKind() == RetrofitError.Kind.NETWORK){ + log.warn("Retrofit Exception occurred of kind NETwork : {}", retrofitError.getBody()) ErrorResponseModel networkErrorResponse = populateNetworkErrorResponse(retrofitError) return new ResponseEntity(networkErrorResponse, HttpStatus.INTERNAL_SERVER_ERROR) } if (retrofitError.getResponse()!=null && retrofitError.getResponse().getStatus() > 0){ + log.warn("Exception occurred in : {}", retrofitError.getBody()) if (retrofitError.getResponse().getBody() !=null){ InputStream inputStream = null try { @@ -72,7 +74,7 @@ class RetrofitErrorHandler { return new ResponseEntity(defaultErrorResponse, HttpStatus.INTERNAL_SERVER_ERROR) } - @ExceptionHandler(PipelineController.PipelineException) + /*@ExceptionHandler(PipelineController.PipelineException) @ResponseBody ResponseEntity> handlePipelineException(PipelineController.PipelineException ex) { Map response = new HashMap<>(); @@ -87,7 +89,7 @@ class RetrofitErrorHandler { log.error("PipelineException occurred: {}", ex.getMessage(), ex); return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST); - } + }*/ private ErrorResponseModel populateDefaultErrorResponseModel() {