docs/generated/contracts.mdgenerated from code
Reference · 2 min read
api-error
Contracts: api-error.
Read as
Source: crates/lvcs-api/src/error.rs.
1/// `data` of every JSON-RPC error the daemon answers.2///3/// discussion:owner/163: what went wrong, said for a reader who has never seen4/// LVCS, and how to recover from it.5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]6pub struct ErrorData {7 /// What went wrong, in plain words.8 pub reason: String,9 /// How to recover: a `recover` value among the error code's.10 pub recover: String,11 /// The one action that recovers, present exactly when `recover` isn't12 /// `none`.13 #[serde(default, skip_serializing_if = "Option::is_none")]14 pub next: Option<Next>,15 /// The `rule` value that refused the request, present exactly when the16 /// code is `rejected`.17 #[serde(default, skip_serializing_if = "Option::is_none")]18 pub rule: Option<String>,19 /// How long to wait before sending the same request again, present20 /// exactly when `recover` is `retry_after`.21 #[serde(default, skip_serializing_if = "Option::is_none")]22 pub retry_after_ms: Option<u64>,23 /// What the secret scan flagged, present exactly when the code is24 /// `secret_detected`.25 #[serde(default, skip_serializing_if = "Option::is_none")]26 pub secret: Option<SecretHit>,27}2829/// The one action that recovers from an error (discussion:owner/163).30///31/// `op` with `params` is a whole request to send as given; `op` alone is32/// the same request sent again, with the same params; `cli` is a command33/// line, starting `lvcs `, to run in the project root, or, when the step34/// is another peer's (a grant the caller lacks), a plain sentence naming35/// who takes it, since core sends no message (discussion:owner/513); `candidates`36/// alone (discussion:owner/243) are the ids a prefix or alias named more than one37/// of, at most `CANDIDATES_MAX`: send the request again naming one.38#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]39pub struct Next {40 /// An `op` value.41 #[serde(default, skip_serializing_if = "Option::is_none")]42 pub op: Option<String>,43 /// The params to send `op` with.44 #[serde(default, skip_serializing_if = "Option::is_none")]45 pub params: Option<serde_json::Value>,46 /// A command line to run instead.47 #[serde(default, skip_serializing_if = "Option::is_none")]48 pub cli: Option<String>,49 /// The ids an ambiguous prefix named, one of which to name instead.50 #[serde(default, skip_serializing_if = "Vec::is_empty")]51 pub candidates: Vec<String>,52}5354/// What the secret scan flagged (discussion:owner/147 and discussion:owner/163).55///56/// `start..end` are code points of the request's text at its base, or of57/// the text a tree save leaves. Nothing is committed: an edit is58/// refused, and a tree save keeps its bytes on disk and is held for its59/// author's `add --force` (discussion:owner/513).60#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]61pub struct SecretHit {62 /// The document.63 pub address: String,64 /// The flagged text's first code point.65 pub start: usize,66 /// The code point past it.67 pub end: usize,68 /// The scan pattern that flagged it: a known token format's name, or69 /// `entropy`.70 pub pattern: String,71}