When things go wrong, it’s when your people need you most. When one of your users make a mistake on a form, accidentally break a rule or do any other fault, you have a great chance to show them how you handle a situation.
Would you ignore the chance to talk to your users when they need to know something? You shouldn’t, it’s when your users will most likely judge your application the most. When I was modifying some code around Crysandrea, I wrote up this little message:

It may not be much, but if something looks off they will most likely remember the notice and know I will be fixing it soon. After all, I promised. This not only creates a sense of comfort for those who are having some minor issues with the page being tweaked, it’s also creates a sense of relief to see something different that the robotic-like message: “Under construction – Please report any glitches you find”.
So how do I personally write my error/notice messages? I use my own work every day, so that could be a great way to start off. You most likely have to experience the actual error yourself to know what you should say and explain. Many people have many different ways of finding the best words for the message, but just be yourself and make it sound natural, not robotic.