Skip to content

Commit

Permalink
Add nullability annotations to TypedGraphQLError
Browse files Browse the repository at this point in the history
  • Loading branch information
kilink committed Oct 4, 2024
1 parent 7639094 commit d0028c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ class MicrometerServletSmokeTest {
TypedGraphQLError
.newBuilder()
.errorDetail(ErrorDetail.Common.ENHANCE_YOUR_CALM)
.message(exception.message)
.message(exception.message ?: "An error occurred: ${exception::class.simpleName}")
.path(handlerParameters.path)
.build()
CompletableFuture.completedFuture(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import graphql.GraphqlErrorHelper;
import graphql.execution.ResultPath;
import graphql.language.SourceLocation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
Expand Down Expand Up @@ -215,13 +216,13 @@ private Map<String, Object> getExtensions() {
return extensionsMap;
}

public Builder message(String message) {
public Builder message(@NotNull String message) {
this.message = assertNotNull(message);
return this;
}

@Override
public Builder message(String message, Object... formatArgs) {
public Builder message(@NotNull String message, Object... formatArgs) {
if (formatArgs == null || formatArgs.length == 0) {
this.message = assertNotNull(message);
} else {
Expand Down Expand Up @@ -271,27 +272,27 @@ public Builder path(@Nullable List<Object> path) {
return this;
}

public Builder errorType(ErrorType errorType) {
public Builder errorType(@NotNull ErrorType errorType) {
this.errorClassification = assertNotNull(errorType);
return this;
}

public Builder errorDetail(ErrorDetail errorDetail) {
public Builder errorDetail(@NotNull ErrorDetail errorDetail) {
this.errorClassification = assertNotNull(errorDetail);
return this;
}

public Builder origin(String origin) {
public Builder origin(@NotNull String origin) {
this.origin = assertNotNull(origin);
return this;
}

public Builder debugUri(String debugUri) {
public Builder debugUri(@NotNull String debugUri) {
this.debugUri = assertNotNull(debugUri);
return this;
}

public Builder debugInfo(Map<String, Object> debugInfo) {
public Builder debugInfo(@NotNull Map<String, Object> debugInfo) {
this.debugInfo = assertNotNull(debugInfo);
return this;
}
Expand Down

0 comments on commit d0028c6

Please sign in to comment.