Defensive Design for the Web: How to Improve Error Messages, Help, Forms, and Other Crisis Points (2004) by 37signals, while outdated in 2011, does show you various examples of bad error handling, including copy, and explains what's wrong and how to improve. It calls all this "contingency design" (the title of the book is inspired by the concept of defensive driving). Some of the patterns extracted are still relevant today. Notably Amazon was a leader in this area way back then.
The biggest thing I took away from it when I read it back then was that your site should behave like a salesman in a store: if I'm lost or I can't find an item, the salesman will ask me questions to help me find what I'm looking for whereas most websites will just say "Not found" and that's it. Here's an excerpt from the opening chapter:
This book will show you how to use contingency design to improve your site's usability. You'll learn the following:
- What contingency design is and why it's important
- 40 guidelines that will help you prevent errors and rescue customers when things go wrong
- How to make error recovery and prevention part of your long-term design process
- How to evaluate your site's contingency design so you can focus on the areas that need help most
Overall the book is useful in designing error handling in your site or app, but there are some good points made specifically about copy as well. From chapter two, "Show the problem: display obvious error messages and alerts":
A good error message lets a customer instantly know:
- That an error occurred
- What the error is
- How to recover
The chapter contains a huge number of examples (from 2003) of sites (many of which no longer exist). Each discussion point includes examples of sites doing things the wrong way and why, and examples of sites doing things well and why.