You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2017/12/16 09:30:25 UTC

[GitHub] eolivelli commented on a change in pull request #868: ISSUE #863: BK client error messages needs to be more descriptive

eolivelli commented on a change in pull request #868: ISSUE #863: BK client error messages needs to be more descriptive
URL: https://github.com/apache/bookkeeper/pull/868#discussion_r157338225
 
 

 ##########
 File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/client/api/BKException.java
 ##########
 @@ -52,10 +67,33 @@ public final int getCode() {
         return this.code;
     }
 
+    /**
+     * Get code identifier name by code value.
+     *
+     * @param code the error code value
+     *
+     * @return the code identifier name
+     */
+    public static String getCodeName(int code) {
+        String name = codeNames.get(code);
+        return name != null ? name : Integer.toString(code);
+    }
+
+    /**
+     * Creates a lazy error code formatter suitable to pass to log functions.
+     *
+     * @param code the error code value
+     *
+     * @return lazy error code log formatter
+     */
+    public static Object codeLogger(int code) {
+        return new CodeLogFormatter(code);
 
 Review comment:
   As the number of rc is limited can't we have a pool and save memory allocations? this code may be executed inside the write path or read path 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services