Skip to content

Commit 473de71

Browse files
enhance JSON processing error message
1 parent c64af32 commit 473de71

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/cucumber/tutorial/util/PlainHttpResponseUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ public static PlainHttpResponse from(String content) {
3131
try {
3232
return mapper.readValue(content, PlainHttpResponse.class);
3333
} catch (JsonProcessingException e) {
34-
throw new RuntimeException("Cannot convert to PlainHttpResponse object:\n" + content, e);
35-
}
34+
throw new RuntimeException("Cannot convert to PlainHttpResponse object:\n" + content+"\n\nExpected:\n{\n" +
35+
" [optional] \"status\": <object>,\n" +
36+
" [optional] \"reason\": \"<text>\",\n" +
37+
" [optional] \"body\": <object>,\n" +
38+
" [optional] \"headers\": <json array> ex: [ {\"h1\": \"v1\"}, {\"h2\": \"v2\"} ]\n" +
39+
"}", e); }
3640
}
3741

3842
public static PlainHttpResponse from(ClassicHttpResponse response) {

0 commit comments

Comments
 (0)