@@ -57,6 +57,7 @@ public <T> Document asDocumentInternal(T object) {
5757 JsonNode node = objectMapper .convertValue (object , JsonNode .class );
5858 return loadDocument (node );
5959 } catch (IllegalArgumentException iae ) {
60+ log .error ("Error while converting object to document " , iae );
6061 if (iae .getCause () instanceof JsonMappingException ) {
6162 JsonMappingException jme = (JsonMappingException ) iae .getCause ();
6263 if (jme .getCause () instanceof StackOverflowError ) {
@@ -73,12 +74,12 @@ public <T> T asObjectInternal(Document document, Class<T> type) {
7374 try {
7475 return getObjectMapper ().convertValue (document , type );
7576 } catch (IllegalArgumentException iae ) {
77+ log .error ("Error while converting document to object " , iae );
7678 if (iae .getCause () instanceof JsonMappingException ) {
7779 JsonMappingException jme = (JsonMappingException ) iae .getCause ();
7880 if (jme .getMessage ().contains ("Can not construct instance" )) {
7981 throw new ObjectMappingException (errorMessage (
80- "no default parameter-less constructor found for "
81- + type .getName (), OME_NO_DEFAULT_CTOR ));
82+ jme .getMessage (), OME_NO_DEFAULT_CTOR ));
8283 }
8384 }
8485 throw iae ;
@@ -125,6 +126,7 @@ public Document parse(String json) {
125126 JsonNode node = objectMapper .readValue (json , JsonNode .class );
126127 return loadDocument (node );
127128 } catch (IOException e ) {
129+ log .error ("Error while parsing json" , e );
128130 throw new ObjectMappingException (errorMessage ("failed to parse json " + json ,
129131 OME_PARSE_JSON_FAILED ));
130132 }
@@ -137,6 +139,7 @@ public String toJson(Object object) {
137139 getObjectMapper ().writeValue (stringWriter , object );
138140 return stringWriter .toString ();
139141 } catch (IOException e ) {
142+ log .error ("Error while serializing object to json" , e );
140143 throw new ObjectMappingException (JSON_SERIALIZATION_FAILED );
141144 }
142145 }
0 commit comments