Add error handling for non-existing object with corresponding tests