Skip to content

Commit 4e61268

Browse files
docs: unbloat error message guide (#45111)
1 parent f365355 commit 4e61268

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

docs/src/content/docs/contributing/error-messages.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ Use actionable messages that explain what went wrong, what is expected, and how
99

1010
## Prefer constructive language
1111

12-
- Avoid: `invalid`, `cannot`, `must`, `failed` without guidance.
13-
- Prefer adding: `expected`, `requires`, `should`, `example`.
12+
Avoid bare words like `invalid`, `cannot`, `must`, or `failed` when they do not explain the fix. Prefer messages that include what was expected and, when helpful, an example.
1413

1514
`invalid repo format 'gh-aw' — expected 'owner/repo' format (for example: 'github/gh-aw')`
1615

@@ -24,18 +23,11 @@ Use `fmt.Errorf` for operational wrapping (`%w`) outside validation logic when y
2423

2524
## Error type selection
2625

27-
- `NewValidationError(...)`: bad input/config shape, missing fields, unsupported values.
28-
- `NewOperationError(...)`: runtime actions fail (fetching, file IO, network, command execution).
29-
- `NewConfigurationError(...)`: safe-outputs/config wiring errors.
30-
- `fmt.Errorf(...%w...)`: wrap lower-level errors with actionable context.
26+
Use `NewValidationError(...)` for bad input or config shape, missing fields, and unsupported values. Use `NewOperationError(...)` for runtime failures such as fetching, file IO, network, or command execution. Use `NewConfigurationError(...)` for safe-outputs and config wiring errors. Use `fmt.Errorf(...%w...)` to wrap lower-level errors with actionable context.
3127

3228
## Suggestion text requirements
3329

34-
Good suggestions:
35-
36-
1. Say what to change
37-
2. Include a concrete YAML/code example
38-
3. Prefer ✓/✗ examples when ambiguity is likely
30+
Good suggestions say what to change, include a concrete YAML or code example, and use ✓/✗ examples when ambiguity is likely.
3931

4032
Example:
4133

@@ -50,6 +42,4 @@ engine: unknown
5042

5143
## YAML example guidance
5244

53-
- Keep examples minimal and valid YAML
54-
- Use real field names from frontmatter
55-
- Quote only when required by YAML syntax
45+
Keep examples minimal and valid YAML, use real field names from frontmatter, and quote only when required by YAML syntax.

0 commit comments

Comments
 (0)