Print error message depending on whether object is expected to exist or not