MCPcopy
hub / github.com/devtron-labs/devtron / NewResourceNotFoundError

Function NewResourceNotFoundError

internal/util/ResourceErrorFactory.go:34–41  ·  view source on GitHub ↗

NewResourceNotFoundError creates a user-friendly error for resource not found scenarios Leverages existing util.NewApiError() function

(resourceType, resourceId string)

Source from the content-addressed store, hash-verified

32// NewResourceNotFoundError creates a user-friendly error for resource not found scenarios
33// Leverages existing util.NewApiError() function
34func NewResourceNotFoundError(resourceType, resourceId string) *ApiError {
35 return NewApiError(
36 http.StatusNotFound,
37 fmt.Sprintf("%s with ID '%s' not found", resourceType, resourceId),
38 fmt.Sprintf("%s not found: %s", resourceType, resourceId),
39 ).WithCode(constants.ResourceNotFound).
40 WithUserDetailMessage(fmt.Sprintf("The requested %s does not exist or has been deleted.", resourceType))
41}
42
43// NewDuplicateResourceError creates a user-friendly error for duplicate resource scenarios
44func NewDuplicateResourceError(resourceType, resourceName string) *ApiError {

Callers 4

HandleErrorMethod · 0.92
HandleResourceNotFoundFunction · 0.92
WriteJsonRespFunction · 0.92

Calls 3

NewApiErrorFunction · 0.85
WithUserDetailMessageMethod · 0.80
WithCodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…