Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nullability annotations to TypedGraphQLError #2025

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading