emit error events instead of throwing where possible

refactored into dispatchError(err, callback), which
calls the callback if it's set, otherwise emits the error
on the db object
namespace all the things
Merge pull request #74 from rvagg/feature/emit-error-not-throw

emit error events instead of throwing where possible