/**
  * Returns the error for the supplied integer constant.
  *
  * @param code to find error for
  * @return error
  */
 public static Error valueOf(final int code) {
   for (Error e : Error.values()) {
     if (e.getCode() == code) {
       return e;
     }
   }
   return null;
 }