add try/catch around emit