How to Write API Errors That Keep Your Users Moving Forward
Blog post from ReadMe
Good API error messages should not only report what went wrong but also guide users on how to resolve the issue, enhancing the developer's experience. Instead of using generic error messages like "Not Found," it is beneficial to provide unique error identifiers, detailed messages, and suggestions for fixing the problem, such as specifying the correct input parameters. Including links to relevant documentation and contact information for support can further assist users in resolving their issues. Additionally, incorporating a touch of creativity, such as whimsical poems, can make the error experience more engaging and align with a company's values, although it's optional. The ultimate goal is to create error messages that act as helpful guardrails, keeping users moving forward rather than leaving them at a dead end.