Skip to content

Commit

Permalink
Remove unused methods in Result
Browse files Browse the repository at this point in the history
  • Loading branch information
antas-marcin committed Nov 25, 2024
1 parent d4d4194 commit b0a00b4
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/main/java/io/weaviate/client/base/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@ToString
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
public class Result<T> {
int statusCode;
T result;
WeaviateError error;

Expand All @@ -23,7 +22,6 @@ public Result(Response<T> response) {
}

public Result(int statusCode, T body, WeaviateErrorResponse errors) {
this.statusCode = statusCode;
if (errors != null && errors.getError() != null) {
List<WeaviateErrorMessage> items = errors.getError().stream().filter(Objects::nonNull).collect(Collectors.toList());
this.error = new WeaviateError(statusCode, items);
Expand All @@ -37,16 +35,6 @@ public Result(int statusCode, T body, WeaviateErrorResponse errors) {
}
}

/**
* Copy the Result object with a null body, preserving only the status code and the error message.
*
* @param <NULL> Would-be response type. It's required for type safety, but can be anything since the body is always set to null.
* @return A copy of this Result.
*/
public <NULL> Result<NULL> toErrorResult() {
return new Result<>(this.error.getStatusCode(), null, WeaviateErrorResponse.builder().error(this.error.getMessages()).build());
}

public boolean hasErrors() {
return this.error != null;
}
Expand Down

0 comments on commit b0a00b4

Please sign in to comment.