009 add errorcode

@m21: the `if (!wallet)` check is often done -- but I'm sort of wondering: when and how does this fail, if at all?