From 1fc6db2abc8a7b0eaa35f61343d2bb267b5dd2ec Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Wed, 6 Nov 2024 10:58:34 -0500 Subject: [PATCH] Review feedback --- .../com/fauna/response/ConstraintFailure.java | 20 +++++++++++-------- .../java/com/fauna/response/ErrorInfo.java | 17 +++++++++++----- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/fauna/response/ConstraintFailure.java b/src/main/java/com/fauna/response/ConstraintFailure.java index 04b9b9ba..f01a9481 100644 --- a/src/main/java/com/fauna/response/ConstraintFailure.java +++ b/src/main/java/com/fauna/response/ConstraintFailure.java @@ -21,11 +21,15 @@ public final class ConstraintFailure { private final PathElement[][] paths; /** - * Initialize a new ConstraintFailure instance. + * Initialize a new ConstraintFailure instance. Queries that fail a check + * or unique + * constraint> return a constraint failure. * - * @param message The constraint failure message. - * @param name The constraint failure name. - * @param paths The constraint failure paths. + * @param message Human-readable description of the constraint failure. + * @param name Name of the failed constraint. + * @param paths A list of paths where the constraint failure occurred. */ public ConstraintFailure( final String message, @@ -135,7 +139,7 @@ public Optional getName() { } /** - * Gets an optional of path elements related to the constraint failure. + * Gets an optional path elements related to the constraint failure. * * @return An array of arrays of PathElements. */ @@ -235,7 +239,7 @@ public static PathElement parse(final JsonParser parser) /** * Tests whether the PathElement stores a string or an integer. * - * @return True if it's a string, else false. + * @return If it's a string, true. Otherwise, false. */ public boolean isString() { return sVal != null; @@ -276,7 +280,7 @@ public static class Builder { * Sets a message on the builder. * * @param message The message to set. - * @return this + * @return this. */ public Builder message(final String message) { this.message = message; @@ -287,7 +291,7 @@ public Builder message(final String message) { * Sets a name on the builder. * * @param name The name to set. - * @return this + * @return this. */ public Builder name(final String name) { this.name = name; diff --git a/src/main/java/com/fauna/response/ErrorInfo.java b/src/main/java/com/fauna/response/ErrorInfo.java index 7883a29e..1d288d95 100644 --- a/src/main/java/com/fauna/response/ErrorInfo.java +++ b/src/main/java/com/fauna/response/ErrorInfo.java @@ -32,10 +32,17 @@ public class ErrorInfo { /** * Initializes a new ErrorInfo. * - * @param code The Fauna error code - * @param message The error message - * @param constraintFailures The constraint failures, if any - * @param abort A abort JSON node of the response, if any + * @param code The Fauna + * error code. + * @param message A short, human-readable description of the + * error. + * @param constraintFailures The constraint failures for the error, if any. + * Only present if the error code is + * `constraint_failure`. + * @param abort A user-defined error message passed using an + * FQL `abort()` method call. Only present if the error + * code is `abort`. */ public ErrorInfo( final String code, @@ -142,7 +149,7 @@ public Optional getConstraintFailures() { } /** - * Gets the abort JSON node. + * Gets the user-defined abort error message as a JSON node. * * @return An optional TreeNode with the abort data. */