Added a few more unit tests, focusing around error conditions
No new bugs found, or functional changes, just more unit tests and more code coverage.