Ensure errors types make use of displaydoc::Display
andthiserror::Error
#4544
Labels
Good first issue
Indicates a good issue for first-time contributors
Description
Some types used as error variants for
Result::Err
do not properly implementdisplaydoc::Display
andthiserror::Error
.Some examples are:
/// Could not initialize metrics: {0:?}
should be/// Could not initialize metrics: {0}
JailerError
should usedisplaydoc::Display
,VcpuSendEventError
should usedisplaydoc::Display
.Ideally all types which implement
std::error::Error
should implementstd::fmt::Display
using thestd::fmt::Display
implementation of types they contain (this is true for all error types both structs and enums).{0}
prints the value with thestd::fmt::Display
implementation while{0:?}
prints the value with thestd::fmt::Debug
implementation.Exceptions are that:
Display
implementation due to the underlying type not implementingError
orDisplay
e.g. if the underlying type isVec<u8>
.Display
implementation due to the underlying type being from an external library. In this case it should still be changed, but this is unlikely to fit into the hackathon.Possible instances can be seen
Acceptance Criteria
Merge a PR fixing instances of this.
The text was updated successfully, but these errors were encountered: