private static int getErrorCode(String jsonErrorObject) throws IOException {
    @SuppressWarnings("unchecked")//JSON key is always a String
    Map<String, Object> retProps = JsonBuilder.jsonToMap(jsonErrorObject + "blah blah");
    int hiveRetCode = -1;
    if(retProps.get(ERROR_CODE) !=null) {
      hiveRetCode = Integer.parseInt(retProps.get(ERROR_CODE).toString());
    }
    return hiveRetCode;
  }
It's expected that Templeton returns a properly formatted JSON object when it
encounters an error.  It should have {@code ERROR_CODE} element in it which
should be the Hive canonical error msg code.
@return the code or -1 if it cannot be found
hcatalog/webhcat/svr/src/test/java/org/apache/hive/hcatalog/templeton/TestWebHCatE2e.java