add try catch, emit error