use error and success constants and throw an error if getting metadata
fails.