MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / with_request_id

Function with_request_id

libatomic/src/daemon/services_maintenance/compact.rs:189–204  ·  view source on GitHub ↗
(status: Status, request_id: &str)

Source from the content-addressed store, hash-verified

187}
188
189fn with_request_id(status: Status, request_id: &str) -> Status {
190 let code = match status.code() {
191 tonic::Code::Unavailable => ErrorCode::ResourceExhausted,
192 tonic::Code::InvalidArgument => ErrorCode::InvalidArgument,
193 tonic::Code::NotFound => ErrorCode::RepositoryNotFound,
194 tonic::Code::FailedPrecondition => ErrorCode::PreconditionFailed,
195 _ => ErrorCode::Internal,
196 };
197 let info = ErrorInfo {
198 code: code as i32,
199 message: status.message().to_string(),
200 request_id: Some(request_id.to_string()),
201 ..Default::default()
202 };
203 Status::with_details(status.code(), status.message(), info.encode_to_vec().into())
204}
205
206#[cfg(test)]
207mod tests;

Callers 1

compactFunction · 0.85

Calls 2

codeMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected