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

Introduce a CONFLICT error detail catered for mutations. #696

Merged
merged 1 commit into from Oct 15, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -121,6 +121,17 @@ enum Common implements ErrorDetail {
*/
MISSING_RESOURCE(FAILED_PRECONDITION),

/**
* Indicates the operation conflicts with the current state of the target resource.
* Conflicts are most likely to occur in the context of a mutation.
* <p>
* For example, you may get a CONFLICT when writing a field with a reference value that is
* older than the one already on the server, resulting in a version control conflict.
* <p>
* HTTP Mapping: 409 Conflict.
* Error Type: FAILED_PRECONDITION
*/
CONFLICT(FAILED_PRECONDITION),

/**
* Service Error.
Expand Down
Expand Up @@ -226,6 +226,13 @@ public static Builder newBadRequestBuilder() {
return new Builder().errorType(ErrorType.BAD_REQUEST);
}

/**
* Create new Builder instance to further customize an error that results in a {@link ErrorDetail.Common#CONFLICT conflict}.
* @return A new TypedGraphQLError.Builder instance to further customize the error. Pre-sets {@link ErrorDetail.Common#CONFLICT}.
*/
public static Builder newConflictBuilder() {
return new Builder().errorDetail(ErrorDetail.Common.CONFLICT);
}

@Override
public String toString() {
Expand Down