Skip to content

Commit

Permalink
refactor: removed use of generic runtime exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Ruaux committed Aug 15, 2022
1 parent 7e4e741 commit 3151eba
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.redis.riot.convert;

import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.converter.Converter;

import com.fasterxml.jackson.core.JsonProcessingException;
Expand All @@ -18,7 +20,8 @@ public String convert(T source) {
try {
return writer.writeValueAsString(source);
} catch (JsonProcessingException e) {
throw new RuntimeException("Could not convert object to XML", e);
throw new ConversionFailedException(TypeDescriptor.forObject(source), TypeDescriptor.valueOf(String.class),
source, e);
}
}
}

0 comments on commit 3151eba

Please sign in to comment.