Re-add tests for write failures

Commit d2173f5f0ecbf4ed93c768e975435b04df3186ec removed the complete
os & syscall mocking layer as overly complex. This commit adds back
the simplest possible thing: hooks to control the database file
writes.

Missing tests: TestDBOpenMetaFileError, TestDBMmapStatError.
These are harder to test without more extensive mocking.

Conflicts:
	db_test.go
Merge pull request #86 from benbjohnson/mock

Re-add tests for write failures
Error refactoring.

Fixed up a few error issues and refactored out the Error type.
Merge pull request #87 from benbjohnson/errors

Error refactoring