code: public static StoreException create(final Type type, final Throwable cause, final String errorMessage) {
          Preconditions.checkArgument(cause != null || (errorMessage != null && !errorMessage.isEmpty()),
                  "Either cause or errorMessage should be non-empty");
          StoreException exception;
          switch (type) {
              case DATA_EXISTS:
                  exception = new DataExistsException(errorMessage, cause);
                  break;
              case DATA_NOT_FOUND:
                  exception = new DataNotFoundException(errorMessage, cause);
                  break;
              case DATA_CONTAINS_ELEMENTS:
                  exception = new DataNotEmptyException(errorMessage, cause);
                  break;
              case WRITE_CONFLICT:
                  exception = new WriteConflictException(errorMessage, cause);
                  break;
              case ILLEGAL_STATE:
                  exception = new IllegalStateException(errorMessage, cause);
                  break;
              case OPERATION_NOT_ALLOWED:
                  exception = new OperationNotAllowedException(errorMessage, cause);
                  break;
              case CONNECTION_ERROR:
                  exception = new StoreConnectionException(errorMessage, cause);
                  break;
              case UNKNOWN:
                  exception = new UnknownException(errorMessage, cause);
                  break;
              default:
                  throw new IllegalArgumentException("Invalid exception type");
          }
          return exception;
      }
docs: Factory method to construct Store exceptions.
  
  @param type          Type of Exception.
  @param cause         Exception cause.
  @param errorMessage  The detailed error message.
  @return Instance of type of StoreException.