| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 -- Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 2 -- Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 3 -- for details. All rights reserved. Use of this source code is governed by a | 3 -- for details. All rights reserved. Use of this source code is governed by a |
| 4 -- BSD-style license that can be found in the LICENSE file. | 4 -- BSD-style license that can be found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <!-- |
| 8 -- Note: if you move this file to a different location, please make sure that |
| 9 -- you also update these references to it: |
| 10 -- * pkg/compiler/lib/src/diagnostics/messages.dart |
| 11 -- * pkg/dart_messages/lib/shared_messages.dart |
| 12 -- * pkg/front_end/lib/src/base/errors.dart |
| 13 -- * https://github.com/dart-lang/linter/ |
| 14 --> |
| 15 |
| 7 # Guide for Writing Diagnostics | 16 # Guide for Writing Diagnostics |
| 8 | 17 |
| 9 ## The Rule of 3 | 18 ## The Rule of 3 |
| 10 | 19 |
| 11 A great message conveys the following three things: | 20 A great message conveys the following three things: |
| 12 | 21 |
| 13 1. What is wrong? | 22 1. What is wrong? |
| 14 2. Why is it wrong? | 23 2. Why is it wrong? |
| 15 3. How do I fix it? | 24 3. How do I fix it? |
| 16 | 25 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 85 |
| 77 Versus: | 86 Versus: |
| 78 | 87 |
| 79 "Change the return type." // Avoid this. | 88 "Change the return type." // Avoid this. |
| 80 | 89 |
| 81 Notice that the style of the language in which this guide is written, is mostly
imperative. That's not an example to follow when writing diagnostics. | 90 Notice that the style of the language in which this guide is written, is mostly
imperative. That's not an example to follow when writing diagnostics. |
| 82 | 91 |
| 83 ## Other Resources | 92 ## Other Resources |
| 84 | 93 |
| 85 One language and community where good error messages have been discussed intensi
vely is [Elm](http://elm-lang.org/blog/compiler-errors-for-humans). | 94 One language and community where good error messages have been discussed intensi
vely is [Elm](http://elm-lang.org/blog/compiler-errors-for-humans). |
| OLD | NEW |