Custom message if authentication fails?

Hi,

I would like to send a custom message to the users when they try to authenticate and it fails.

Could it be done as a plugin? I’m not sure if it is technically possible.

Thanks in advance,

Enrique.