Print the short description of exception in OscA1Client 34/2634/3
authorRehanRaza <muhammad.rehan.raza@est.tech>
Tue, 3 Mar 2020 12:36:45 +0000 (13:36 +0100)
committerRehanRaza <muhammad.rehan.raza@est.tech>
Tue, 3 Mar 2020 12:59:58 +0000 (13:59 +0100)
Avoid garbage from running the unit-tests which cause exceptions.
Now, it prints just one line:
ERROR org.oransc.policyagent.clients.OscA1Client - Unexpected response for policy type: {"type":"type1"}, exception: org.json.JSONException: JSONObject["create_schema"] not found.

Change-Id: I6c5d0037b9d068a1fd069d521af1070a8ec55c54
Signed-off-by: RehanRaza <muhammad.rehan.raza@est.tech>
policy-agent/src/main/java/org/oransc/policyagent/clients/OscA1Client.java

index 3216a48..c596bd5 100644 (file)
@@ -22,12 +22,14 @@ package org.oransc.policyagent.clients;
 
 import java.lang.invoke.MethodHandles;
 import java.util.List;
+
 import org.json.JSONObject;
 import org.oransc.policyagent.configuration.RicConfig;
 import org.oransc.policyagent.repository.Policy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.util.UriComponentsBuilder;
+
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
@@ -135,7 +137,7 @@ public class OscA1Client implements A1Client {
             schemaObj.put(TITLE, policyTypeId);
             return Mono.just(schemaObj.toString());
         } catch (Exception e) {
-            logger.error("Unexcpected response for policy type: {}", policyTypeResponse, e);
+            logger.error("Unexpected response for policy type: {}, exception: {}", policyTypeResponse, e.toString());
             return Mono.error(e);
         }
     }