MCPcopy Create free account
hub / github.com/deventlab/d-engine / map_error_response

Method map_error_response

d-engine-server/src/api/embedded_client.rs:158–174  ·  view source on GitHub ↗
(
        error: ErrorCode,
        leader_hint: Option<LeaderHint>,
        retry_after_ms: Option<u64>,
    )

Source from the content-addressed store, hash-verified

156 }
157
158 fn map_error_response(
159 error: ErrorCode,
160 leader_hint: Option<LeaderHint>,
161 retry_after_ms: Option<u64>,
162 ) -> ClientApiError {
163 match error {
164 ErrorCode::NotLeader => {
165 let (leader_id, leader_address) = if let Some(hint) = leader_hint {
166 (Some(hint.leader_id.to_string()), Some(hint.address))
167 } else {
168 (None, None)
169 };
170 not_leader_error(leader_id, leader_address, retry_after_ms)
171 }
172 _ => server_error(format!("Error code: {error:?}")),
173 }
174 }
175
176 /// Store a key-value pair with strong consistency.
177 ///

Callers

nothing calls this directly

Calls 2

not_leader_errorFunction · 0.85
server_errorFunction · 0.85

Tested by

no test coverage detected