pasha-kuznetsov 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_r157350643
 
 

 ##########
 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:
   Sure! Please see d142c71

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


With regards,
Apache Git Services

Reply via email to