Add more error codes, messages and error checking.

I think these should be testErr and retErr. And I also wonder why we need to cast testErr into a waddrmgr.ManagerError? It should already have that type, no? We may need to change the struct definition to use that type instead of "error", though.