Skip to content

Commit

Permalink
Merge pull request #696 from Netflix/feature/error-conflict
Browse files Browse the repository at this point in the history
Introduce a CONFLICT error detail catered for mutations.
  • Loading branch information
berngp committed Oct 15, 2021
2 parents d9e83b3 + 2418854 commit 8b1c011
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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

0 comments on commit 8b1c011

Please sign in to comment.