Better error handling.

Fixes #3.
Test coverage.
Merge pull request #15 from rhyolight/no-issues-error-handling

Better error handling.