Added throws exception if resource has invalid type