added return value checking.
Merge pull request #26 from redboltz/add_throw

added return value checking.