Throw error if location is not defined