Kind of ugly still, but better than what you're doing:
$ bitcoind walletpassphrase '' 1 # not encrypted
error: {"code":-15,"message":"Error: running with an unencrypted wallet, but walletpassphrase was called."}
$ bitcoind walletpassphrase '' 1 # encrypted and locked
error: {"code":-1,"message":"walletpassphrase <passphrase> <timeout>\nStores the wallet decryption key in memory for <timeout> seconds."}
$ bitcoind walletpassphrase '' 1 # encrypted an unlocked
error: {"code":-17,"message":"Error: Wallet is already unlocked."}