Skip to main content

Module error

Module error 

Source
Expand description

DhtError — the crate’s error type.

Every variant that carries text carries a SafeText, never a String (#1675). A String parameter accepts anything, so it invites a caller to embed whatever a peer sent; the safety of the crate then rests on every present and future caller remembering a convention that is written down nowhere in the type. SafeText cannot be built from a runtime String without saying the text is untrusted, so raw peer text is unrepresentable in a DhtError rather than merely discouraged.

The constructors below make the provenance of every message explicit at the call site: DhtError::transport for text this crate wrote, DhtError::transport_from_untrusted for text that came from, or was derived from, a remote party.

Enums§

DhtError
An error from a DHT operation.