Add error handling.
Merge pull request #3 from shinoburc/add-error-handling

Add error handling.