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

Function StatusForBundleError

internal/api/core/bundles.go:333–356  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

331}
332
333func StatusForBundleError(err error) int {
334 switch {
335 case err == nil:
336 return http.StatusOK
337 case errors.Is(err, bundlepkg.ErrActivationNotFound),
338 errors.Is(err, bundlepkg.ErrBundleNotFound),
339 errors.Is(err, bundlepkg.ErrProfileNotFound),
340 errors.Is(err, extensionpkg.ErrExtensionNotFound):
341 return http.StatusNotFound
342 case errors.Is(err, bundlepkg.ErrDefaultChannelBusy),
343 errors.Is(err, bundlepkg.ErrAgentConflict),
344 errors.Is(err, extensionpkg.ErrExtensionHasActiveBundles):
345 return http.StatusConflict
346 case errors.Is(err, bundlepkg.ErrAgentReferenceNotFound):
347 return http.StatusUnprocessableEntity
348 case errors.Is(err, bundlepkg.ErrWebhookUnsupported):
349 return http.StatusBadRequest
350 case errors.Is(err, workspacepkg.ErrWorkspaceNotFound),
351 errors.Is(err, workspacepkg.ErrWorkspaceRootMissing):
352 return StatusForWorkspaceError(err)
353 default:
354 return http.StatusInternalServerError
355 }
356}
357
358func bundlepkgStableID(prefix string, parts ...string) string {
359 normalized := make([]string, 0, len(parts))

Calls 2

StatusForWorkspaceErrorFunction · 0.85
IsMethod · 0.45