Skip to content

Commit 321cdc3

Browse files
committed
Update code as per suggestions
1 parent bffdd7e commit 321cdc3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reactive/src/main/java/feign/reactive/ReactiveDecoder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ public Object decode(Response response, Type type) throws IOException, FeignExce
4444
Type lastType = Types.resolveLastTypeParameter(type, Flux.class);
4545
Type listType = Types.parameterize(List.class, lastType);
4646
Object decoded = delegate.decode(response, listType);
47-
if (decoded instanceof Iterable) {
47+
try {
4848
return Flux.fromIterable((Iterable) decoded);
49-
} else {
50-
String errorMessage = "Expected type Iterable, but was: " + decoded.getClass();
51-
throw new DecodeException(response.status(), errorMessage, response.request());
49+
} catch (ClassCastException e) {
50+
String errorMessage = "Unable to cast decoded object to Iterable: " + e.getMessage();
51+
throw new DecodeException(response.status(), errorMessage, response.request(), e);
5252
}
5353
}
5454

0 commit comments

Comments
 (0)