Re-add error handling to TSUserKeysDB

All the error handling code was removed from TSUserKeysDatabase. Not sure why but this restores the code and modifies calls to the TSUserKeysDatabase methods to support the new error argument.