X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fcontroller%2FCustomResponseEntityExceptionHandler.java;h=2c432d542884a7ccec0abadb97398bc4d0e4e83d;hb=425ca107bd805dda906b62fc2b03a6f3c815b8a1;hp=062d04fe3d34b64e3aa225d08802717848149b5e;hpb=93a44cb851a49c923126f32016646860d104075c;p=portal%2Fric-dashboard.git diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/CustomResponseEntityExceptionHandler.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/CustomResponseEntityExceptionHandler.java index 062d04fe..2c432d54 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/CustomResponseEntityExceptionHandler.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/CustomResponseEntityExceptionHandler.java @@ -29,22 +29,14 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.client.HttpStatusCodeException; +import org.springframework.web.client.RestClientResponseException; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; /** - * Catches Http status code exceptions and builds a response with code 502 and - * some details wrapped in an ErrorTransport object. This factors out try-catch + * Catches certain exceptions. This controller advice factors out try-catch * blocks in many controller methods. * - * Why 502? I quote:
HTTP server received an invalid response from a - * server it consulted when acting as a proxy or gateway.- * - * This class and the methods are not strictly necessary, the - * SimpleErrorController is invoked when any controller method takes an uncaught - * exception, but this approach provides a better response to the front end and - * doesn't signal internal server error. - * * Also see:
HTTP server received an invalid response from a + * server it consulted when acting as a proxy or gateway.* * @param ex * The exception + * * @param request - * The orignal request + * The original request + * * @return A response entity with status code 502 plus some details in the body. */ - @ExceptionHandler(HttpStatusCodeException.class) - public final ResponseEntity