MCPcopy Create free account
hub / github.com/JaredStewart/coderlm / into_response

Method into_response

server/src/server/errors.rs:23–37  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

21
22impl IntoResponse for AppError {
23 fn into_response(self) -> Response {
24 let (status, message) = match &self {
25 AppError::NotFound(msg) => (StatusCode::NOT_FOUND, msg.clone()),
26 AppError::BadRequest(msg) => (StatusCode::BAD_REQUEST, msg.clone()),
27 AppError::Gone(msg) => (StatusCode::GONE, msg.clone()),
28 AppError::Internal(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg.clone()),
29 };
30
31 let body = json!({
32 "error": message,
33 "status": status.as_u16(),
34 });
35
36 (status, Json(body)).into_response()
37 }
38}
39
40impl From<anyhow::Error> for AppError {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected