catch all errors inside onerror
Merge pull request #7 from kjbekkelund/trycatch

catch all errors inside onerror