pub enum TransportError {
Protocol(String),
Io(Error),
Unimplemented(&'static str),
Refused(String),
}Expand description
What went wrong while serving.
Variants§
Protocol(String)
The protocol state machine refused the request.
Io(Error)
The stream failed.
Unimplemented(&'static str)
Not wired yet. This is the honest answer until gunnar-wire lands,
and it must never quietly become a successful empty response: a clone
that returns no objects and exits zero looks exactly like a working
server serving an empty repository (measured, not asserted).
Refused(String)
The transfer was refused before a single byte reached the client, and the string is the sentence the client is owed.
This variant exists because the other three could not carry one. A
transfer that failed after the advertisement went out cannot be answered
with a fresh pkt-line — the client is mid-pack and the framing belongs to
gunnar-wire’s sideband, which is what UploadPack::report_error is
for. A transfer that failed before the first write can be answered, and
until this variant existed it was not: the session logged the whole
reason and sent the client an exit status and no words, which git renders
as the remote end hung up unexpectedly.
So the variant is the fact “nothing has been written yet”, not a
severity. Only a construction site that knows that may use it, which is
why it is a distinct variant rather than a flag on
TransportError::Protocol.
Implementations§
Source§impl TransportError
impl TransportError
Sourcepub fn client_message(&self) -> Option<String>
pub fn client_message(&self) -> Option<String>
What the client is told, or None when the client cannot be told
anything.
Named after crate::server::DispatchError::client_message and
gunnar_wire::Error::client_message because it is the same contract in a
third place (one implementation): a refusal the operator can see and the user cannot
is half a fix.
None for TransportError::Protocol and TransportError::Io
on purpose, and it is the conservative answer rather than the
convenient one: those two are raised from inside a transfer that may
already have written an advertisement, a NAK or half a pack, and a raw
pkt-line appended to that stream is corruption, not an error message.
Trait Implementations§
Source§impl Debug for TransportError
impl Debug for TransportError
Source§impl Display for TransportError
impl Display for TransportError
Source§impl Error for TransportError
impl Error for TransportError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()