Catch only specified exception and simplify code.
Merge pull request #21 from gmist/errhandler_simplify

Catch only specified exception and simplify code.