Skip to content

Commit d12f66a

Browse files
yaahcshepmaster
andauthored
Apply suggestions from code review
Co-authored-by: Jake Goulding <shepmaster@mac.com>
1 parent 5bfa046 commit d12f66a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

text/0000-project-error-handling.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This RFC establishes a new project group, under the libs team, to drive efforts
1111
# Motivation
1212
[motivation]: #motivation
1313

14-
The error handling project group aims to reduce confusion on how to structure error handling for users in the rust community. This will be accomplished by creating learning resources and pushing effort to upstream widely used crates into std. As a secondary goal this project group will also try to resolve some known issues with the Error trait and reporting errors in panics/termination.
14+
The error handling project group aims to reduce confusion on how to structure error handling for users in the Rust community. This will be accomplished by creating learning resources and pushing effort to upstream widely used crates into the standard library. As a secondary goal, this project group will also try to resolve some known issues with the `Error` trait and reporting errors in panics/termination.
1515

1616
# Charter
1717
[charter]: #charter
@@ -22,9 +22,9 @@ The error handling project group aims to reduce confusion on how to structure er
2222

2323
- Recoverable error: An error that can reasonably be expected to be encountered e.g. a missing file.
2424
- Unrecoverable error: An error that cannot reasonably be expected to happen and which indicates a bug e.g. indexing out of bounds.
25-
- Error Type: A type that represents a recoverable error. Error types can optionally implement the error trait so that it can be reported to the user or be converted into a trait object.
26-
- Reporting Type: A type that can store all recoverable errors an application may need to propogate and print them as error reports.
27-
- Reporting types can represent the recoverable errors either via concrete types, likely paramaterized, or trait objects.
25+
- Error Type: A type that represents a recoverable error. Error types can optionally implement the `Error` trait so that it can be reported to the user or be converted into a trait object.
26+
- Reporting Type: A type that can store all recoverable errors an application may need to propagate and print them as error reports.
27+
- Reporting types can represent the recoverable errors either via concrete types, likely parameterized, or trait objects.
2828
- Reporting types often bundle context with errors when they are constructed, e.g. `Backtrace`.
2929
- Reporting types often provide helper functions for creating ad hoc errors whose only purpose is to be reported e.g. `anyhow::format_err!` or `eyre::WrapErr`.
3030

@@ -34,42 +34,42 @@ Here is a tenative starting point, subject to change:
3434

3535
- Use `Result` and `Error` types for recoverable errors.
3636
- Use `panic` for unrecoverable errors.
37-
- Impl `Error` for error types that may need to be reported to a human or be composed with other errors.
37+
- Implement `Error` for error types that may need to be reported to a human or be composed with other errors.
3838
- Use enums for types representing multiple failure cases that may need to be handled.
39-
- For libraries, oftentimes you want to support both reporting and handling so you impl `Error` on a possibly non-exhaustive enum.
39+
- For libraries, oftentimes you want to support both reporting and handling so you implement `Error` on a possibly non-exhaustive enum.
4040
- Error kind pattern for associating context with every enum variant without including the member in every enum variant.
4141
- Convert to a reporting type when the error is no longer expected to be handled beyond reporting e.g. `anyhow::Error` or `eyre::Report` or when trait object + downcast error handling is preferable.
4242
- Recommend `Box`ing concrete error types when stack size is an issue rather than `Box`ing and converting to `dyn Error`s.
43-
- What is the consensus on handling `dyn Error`s? Should it be encouraged or discouraged? Should we look into making `Box<dyn Error...>` impl Error?
43+
- What is the consensus on handling `dyn Error`s? Should it be encouraged or discouraged? Should we look into making `Box<dyn Error...>` implement `Error`?
4444

4545

4646
### Communicate current best practices
4747

48-
- Document the concensus.
48+
- Document the consensus.
4949
- Communicate plan for future changes to error handling, and the libraries that future changes are being based off of.
5050
- Produce learning resources related to current best practices.
5151
- New chapters in the book?
5252

53-
### Evaluate options for error reporting type aka better `Box<dyn Error>`
53+
### Evaluate options for error reporting type a.k.a. better `Box<dyn Error>`
5454

5555
- Survey the current libraries in the ecosystem:
5656
- `anyhow`
5757
- `eyre`
5858
- Evaluate value of features including:
5959
- Single word width on stack
6060
- Error wrapping with display types and with special downcast support.
61-
- report hook + configurable `dyn ReportHandler` type for custom report formats and content, similar to panic handler but for errors.
61+
- Report hook and configurable `dyn ReportHandler` type for custom report formats and content, similar to panic handler but for errors.
6262
- libcore compatibility.
6363

6464
### Consolidate ecosystem by merging best practice crates into std
6565

6666
- Provide a derive macro for `Error` in std.
67-
- Stabilize the `Backtrace` type but possibly not `fn backtrace` on the Error trait.
67+
- Stabilize the `Backtrace` type but possibly not `fn backtrace` on the `Error` trait.
6868
- Provide necessary API on `Backtrace` to support crates like `color-backtrace`.
69-
- Move error to core .
69+
- Move `Error` to core.
7070
- Depends on generic member access.
7171
- Requires resolving downcast dependency on `Box` and blocking the stabilization of `fn backtrace`.
72-
- Potentially stabilize an error Reporting type based on `anyhow` and `eyre` now that they're close to having identical feature sets.
72+
- Potentially stabilize an error reporting type based on `anyhow` and `eyre` now that they're close to having identical feature sets.
7373

7474
### Add missing features
7575

@@ -84,7 +84,7 @@ Here is a tenative starting point, subject to change:
8484

8585
## Membership Requirements
8686

87-
- Group membership is open, any interested party can participate in discussions, repeat contributors will be added appropriate teams.
87+
- Group membership is open, any interested party can participate in discussions, repeat contributors will be added to appropriate teams.
8888

8989
## Additional Questions
9090

0 commit comments

Comments
 (0)