Error Message Text - Best Practices

前端 未结 12 909
北恋
北恋 2021-01-02 03:22

We are changing some of the text for our old, badly written error messages. What are some resources for best practices on writing good error messages (specifically for Wind

12条回答
  •  没有蜡笔的小新
    2021-01-02 04:15

    1. Avoid identical error messages coming from different places; parametrize with file:line if possible, or use other context that lets you, the developer, uniquely identify where the error occurred.
    2. Design the mechanism to allow easy localization, especially if it is a commercial product.
    3. If the error messages are user-visible, make them complete, meaningful sentences that don't assume intimate knowledge of the code; remember, you're always too close to the problem -- the user is not. If possible, give the user guidance on how to proceed, who to contact, etc.
    4. Every error should have a message if possible; if not, then try and make sure that all error-unwind paths eventually reach an error message that sheds light on what happened.

      I'm sure there will be other good answers here...

提交回复
热议问题