MCPcopy Create free account
hub / github.com/compozy/agh / StatusForMemoryError

Function StatusForMemoryError

internal/api/core/errors.go:229–244  ·  view source on GitHub ↗

StatusForMemoryError maps memory-domain errors to transport statuses.

(err error)

Source from the content-addressed store, hash-verified

227
228// StatusForMemoryError maps memory-domain errors to transport statuses.
229func StatusForMemoryError(err error) int {
230 switch {
231 case err == nil:
232 return http.StatusOK
233 case errors.Is(err, ErrMemoryUnsupported):
234 return http.StatusNotImplemented
235 case errors.Is(err, ErrMemoryRejected):
236 return http.StatusUnprocessableEntity
237 case errors.Is(err, os.ErrNotExist):
238 return http.StatusNotFound
239 case errors.Is(err, memory.ErrValidation):
240 return http.StatusBadRequest
241 default:
242 return http.StatusInternalServerError
243 }
244}
245
246// StatusForResourceError maps desired-state resource failures to transport statuses.
247func StatusForResourceError(err error) int {

Callers 15

statusForMemoryErrorFunction · 0.92
statusForMemoryErrorFunction · 0.92
ListMemoryMethod · 0.85
MemoryHealthMethod · 0.85
MemoryHistoryMethod · 0.85
MemoryScopeShowMethod · 0.85
SearchMemoryMethod · 0.85
ReadMemoryMethod · 0.85
WriteMemoryMethod · 0.85
EditMemoryMethod · 0.85

Calls 1

IsMethod · 0.45

Tested by 4

statusForMemoryErrorFunction · 0.74
statusForMemoryErrorFunction · 0.74