dumpprivkey gives an incorrect error message when wallet is locked:
currently is says: error: {"code":-4,"message":"Private key for address 1someknownaddress... is not known"}
even when the private key for that address is known.
better: "Wallet is locked, unable examine 1someknownaddress... "