Skip to content

Commit

Permalink
Merge pull request square#1984 from square/jw/to-string
Browse files Browse the repository at this point in the history
Add toString implementations to Response and Result.
  • Loading branch information
swankjesse authored Aug 21, 2016
2 parents 5d87e5c + 8737e46 commit e02fb37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,11 @@ public Throwable error() {
public boolean isError() {
return error != null;
}

@Override public String toString() {
if (error != null) {
return "Result{isError=true, error=\"" + error + "\"}";
}
return "Result{isError=false, response=" + response + '}';
}
}
4 changes: 4 additions & 0 deletions retrofit/src/main/java/retrofit2/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,8 @@ public T body() {
public ResponseBody errorBody() {
return errorBody;
}

@Override public String toString() {
return rawResponse.toString();
}
}

0 comments on commit e02fb37

Please sign in to comment.