Detecting if resource exists and throwing if not