Add keyExists() method and return the correct error if a key does not exist.