/**
  * Parses the supplied error messages and returns the corresponding error enum. Attempts to find
  * {@link #PATTERN} and parses the first group match as a hexadecimal integer.
  *
  * @param message to parse
  * @return active directory error
  */
 public static Error parse(final String message) {
   if (message != null) {
     final Matcher matcher = PATTERN.matcher(message);
     if (matcher.find()) {
       try {
         return Error.valueOf(Integer.parseInt(matcher.group(1).toUpperCase(), HEX_RADIX));
       } catch (NumberFormatException e) {
         final Logger l = LoggerFactory.getLogger(Error.class);
         l.warn("Error parsing active directory error", e);
       }
     }
   }
   return null;
 }