Fix a number of issues

This reworks some of the error handling stuff and fixes a few things:

Fixes #14, and when integrated it will resolve atom/find-and-replace#197, atom/find-and-replace#242, and probably atom/find-and-replace#192 

TODO

* [x] propagate errors up through the `search` and `replace` functions
* [x] test the `search` and `replace` functions
* Integrate error handling into find and replace