moved origin test into try/catch