imply-cheddar commented on code in PR #16470:
URL: https://github.com/apache/druid/pull/16470#discussion_r1610654658


##########
processing/src/main/java/org/apache/druid/error/InvalidInput.java:
##########
@@ -35,6 +35,37 @@ public static DruidException exception(Throwable t, String 
msg, Object... args)
     return DruidException.fromFailure(new InvalidInput(t, msg, args));
   }
 
+  /**
+   * evalues a condition. If it's false, it throws the appropriate 
DruidException
+   *
+   * @param condition - boolean condition to validate
+   * @param msg - passed through to InvalidInput.exception()
+   * @param args - passed through to InvalidInput.exception()
+   */
+  public static void conditionalException(boolean condition, String msg, 
Object... args)

Review Comment:
   This can be done on top of what's here.  I think it's six-of-one, 
half-dozen-of-another.  Feel free to add such things in a future PR where you 
find it useful @kfaraz 



##########
processing/src/main/java/org/apache/druid/error/DruidException.java:
##########
@@ -176,6 +176,21 @@ public static DruidException defensive(String format, 
Object... args)
     return defensive().build(format, args);
   }
 
+  /**
+   * Build a "defensive" exception, this is an exception that should never 
actually be triggered. Throw to
+   * allow messages to be seen by developers
+   *
+   * @param condition - boolean condition to validate
+   * @param msg - passed through to InvalidInput.exception()
+   * @param args - passed through to InvalidInput.exception()
+   */
+  public static void conditionalDefensive(boolean condition, String msg, 
Object... args)

Review Comment:
   Probably need to add @SuppressWarnings("unused") or find a place to use it.  
It's a bit of a chicken-and-egg as I'm sure these will eventually be used...



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to