You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/11/10 18:56:48 UTC

[GitHub] [cassandra] josh-mckenzie commented on a diff in pull request #1972: CASSANDRA-17967 trunk: Add reason for guardrail triggering

josh-mckenzie commented on code in PR #1972:
URL: https://github.com/apache/cassandra/pull/1972#discussion_r1019504964


##########
src/java/org/apache/cassandra/db/guardrails/Guardrail.java:
##########
@@ -138,8 +143,19 @@ protected void fail(String message, String redactedMessage, @Nullable ClientStat
     @VisibleForTesting
     String decorateMessage(String message)
     {
-        // Add a prefix to error message so user knows what threw the warning or cause the failure
-        return String.format("Guardrail %s violated: %s", name, message);
+        // Add a prefix to error message so user knows what threw the warning or cause the failure.
+        String decoratedMessage = String.format("Guardrail %s violated: %s", name, message);
+
+        // Add the reason for the guardrail triggering, if there is any.
+        if (reason != null)
+        {
+            if (message.endsWith("."))

Review Comment:
   ultra-nit can do on commit if you want: ternary may make this a touch cleaner.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org