pub enum FailureReason {
Show 14 variants
Transport {
status: Option<u16>,
message: String,
},
Backend {
kind: BackendErrorKind,
message: String,
},
Unparseable(String),
CacheMiss,
ReviewLimit {
completed: u32,
limit: u32,
},
ModelStopped {
finish: String,
message: String,
},
Truncated,
MalformedFinding(String),
ToolUnavailable {
tool: String,
detail: String,
},
FileTooLarge {
bytes: u64,
limit: u64,
},
PayloadTooLarge {
bytes: u64,
limit: u64,
},
Unreadable(String),
Unsupported {
extension: Option<String>,
hint: Option<String>,
},
ChainFailed(Vec<ProviderFailure>),
}Expand description
Why one file went unanalyzed.
A bare set of paths cannot tell a dead endpoint from a rate limit from a
truncated response, and the caller needs that to print something a user can
act on. LlmError already carries the detail; it used to be discarded at
the analyzer boundary.
Variants§
Transport
The endpoint was unreachable, or returned a retryable status too many
times. status is the HTTP code when there was one.
Backend
A non-HTTP backend failed with a structured routing class.
Unparseable(String)
A response arrived and no JSON could be extracted from it.
CacheMiss
Cache-only review found no response for this exact prompt and provider.
ReviewLimit
A fresh semantic review was required after the configured remediation budget had already been consumed. This is fail-closed: cached reviews remain usable, but uncached code is never waved through unseen.
ModelStopped
The model stopped before producing JSON, and the server said why.
Distinct from Self::Unparseable because the cause is known and
deterministic - an output-token cap or a content filter - so the answer
is not “ask again” but “this request cannot be served as sent”. finish
is the server’s own word for it, kept as a machine tag beside the human
message exactly as Self::Transport keeps its status.
Truncated
The response parsed only after closing unbalanced delimiters, so it is a prefix of what the model meant to say.
MalformedFinding(String)
A record in the response could not be understood - unknown severity, missing field, unusable line number.
A deterministic tool that should have run could not.
FileTooLarge
The file on disk exceeded the read guard, so drep never read it.
Distinct from Self::PayloadTooLarge because the two measure
different things: this is the file’s own size, checked before any I/O,
and that one is the size of the text the model would have been sent.
They were one variant sharing one limit, which meant bytes held the
file size on one code path and the rendered-payload size on another -
so “file is too large (330102 bytes)” could name a file that ls
reports as 261900 bytes.
PayloadTooLarge
The rendered LLM payload exceeded the ceiling. See Self::FileTooLarge.
Unreadable(String)
The file could not be read from disk.
Unsupported
The user named a file that the running command has no analyzer for.
Only ever produced for an explicitly named path. A walk that turns
up nothing analyzable is legitimately empty - drep check . in a
documentation repository has correctly found no code. A path the user
typed is different: reporting “No issues found.” for a file drep
declined to look at is the single failure this codebase is built to
prevent, and it is the same distinction resolve_paths already draws
for an argument that does not exist at all.
hint names the command that does handle the type, when there is
one. Markdown has drep lint-docs, so the error is a redirection
rather than a dead end.
Fields
ChainFailed(Vec<ProviderFailure>)
A failover chain produced no answer, with what each provider contributed.
Only produced for a chain of two or more providers. A one-provider
config - what drep init writes, and what almost every run uses -
collapses to that provider’s own reason, so it reports exactly what it
did before failover existed, JSON kind included. The trigger is the
chain’s length, not the number of providers that failed: a two-provider
chain stopped dead at the head by a 401 has one failure and is exactly
the case where “which provider, and why did my fallback not run” is the
user’s live question.
Keeping only the last reason would hide a dead local endpoint behind the cloud fallback’s 401; keeping only the first would hide the broken fallback. A user fixing the run needs both.
The list can be shorter than the chain - a 401 at the head stops it, and the providers below were never consulted.
Implementations§
Source§impl FailureReason
impl FailureReason
Sourcepub fn unsupported(path: &Path, hint: Option<String>) -> Self
pub fn unsupported(path: &Path, hint: Option<String>) -> Self
Build an Self::Unsupported for path.
The extension convention (leading dot, None when there is none) is
stated here, beside the variant whose one_line renders it, rather than
at each command that raises one. It was written out twice, which is one
copy per command pointing at the other.
Sourcepub fn one_line(&self) -> String
pub fn one_line(&self) -> String
A single line suitable for a terminal, derived from the variant.
The HTTP status is rendered next to the message so a 429 is visible
without the user having to match the message against a status code
list. This is the load-bearing reason the Transport variant carries
the status as a number rather than only inside the string.
Trait Implementations§
Source§impl Clone for FailureReason
impl Clone for FailureReason
Source§fn clone(&self) -> FailureReason
fn clone(&self) -> FailureReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FailureReason
impl Debug for FailureReason
Source§impl Display for FailureReason
impl Display for FailureReason
impl Eq for FailureReason
Source§impl PartialEq for FailureReason
impl PartialEq for FailureReason
impl StructuralPartialEq for FailureReason
Auto Trait Implementations§
impl Freeze for FailureReason
impl RefUnwindSafe for FailureReason
impl Send for FailureReason
impl Sync for FailureReason
impl Unpin for FailureReason
impl UnsafeUnpin for FailureReason
impl UnwindSafe for FailureReason
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.