protected Response createResponse ( WebApplicationException exception ) { Response response = exception . getResponse ( ) ; int statusCode = response . getStatus ( ) ; Status status = Status . fromStatusCode ( statusCode ) ; NlsRuntimeException error ; if ( exception instanceof ServerErrorException ) { error = new TechnicalErrorUserException ( exception ) ; LOG . error ( "Service failed on server" , error ) ; return createResponse ( status , error , null ) ; } else { UUID uuid = UUID . randomUUID ( ) ; if ( exception instanceof ClientErrorException ) { LOG . warn ( "Service failed due to unexpected request. UUDI: {}, reason: {} " , uuid , exception . getMessage ( ) ) ; } else { LOG . warn ( "Service caused redirect or other error. UUID: {}, reason: {}" , uuid , exception . getMessage ( ) ) ; } return createResponse ( status , exception . getMessage ( ) , String . valueOf ( statusCode ) , uuid , null ) ; } }
Add a response message to an existing response .