add try catch, emit error
Merge pull request #6 from dead-horse/try-catch

add try catch, emit error