Not sure this has been addressed, but if I am hidden and cast a spell that fails, I will not be revealed. However, I will then be attacked by the MOB I was targeting, but still will not be revealed until I successfully cast something.
At least I don't get the message until that point.
Take a look:
Shards of ice crumble into pieces in front of you.
[Delay: 4.0 sec.]
A scavenging mudlark swings a wooden club at you.
The attack is a glancing blow (3).
<182/185 - 120/125 - 18~A scavenging mudlark~A scavenging mudlark is in perfect health.
c dag
Frozen shards of ice begin to crystallize before you. The shards converge into a single dagger, crashing into a scavenging mudlark!
You reveal yourself from your hidden position.
The ice dagger is a decent strike.
[Delay: 4.0 sec.]