janhoy commented on code in PR #2059:
URL: https://github.com/apache/solr/pull/2059#discussion_r1382062723


##########
solr/core/src/java/org/apache/solr/util/circuitbreaker/CircuitBreaker.java:
##########
@@ -62,6 +64,16 @@ public CircuitBreaker() {}
   /** Get error message when the circuit breaker triggers */
   public abstract String getErrorMessage();
 
+  /**
+   * Get http error code, defaults to {@link 
SolrException.ErrorCode#TOO_MANY_REQUESTS} but can be
+   * overridden with system property {@link 
#SYSPROP_SOLR_CIRCUITBREAKER_ERRORCODE}
+   */
+  public static SolrException.ErrorCode getErrorCode() {
+    return SolrException.ErrorCode.getErrorCode(
+        Integer.getInteger(
+            SYSPROP_SOLR_CIRCUITBREAKER_ERRORCODE, 
SolrException.ErrorCode.TOO_MANY_REQUESTS.code));

Review Comment:
   So I learnt something: `Integer.getInteger()` will return the default-value 
also if the system property is set but is not an integer. And `getErrorCode` 
will return `UNKNOWN` (0) for unsupported codes such as `999`. To fail loudly 
we must catch both, and I'll push a solution.



-- 
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: issues-unsubscr...@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to