Short Description
Currently calling logic relies on errors contain "does not exist" to indicate that an entity doesn't exist. We should change this so it more explicit by returning a pointer, so it can be nil to indicate the entity not existing.
Definition of Done
The signatures are updated and the calling logic of the form strings.Contains(err.Error(), "does not exist") is replaced with entity == nil.
Additional context
internal/domain/power-cap.go:279: if strings.Contains(err.Error(), "does not exist") {
internal/domain/power-status.go:1022: if !strings.Contains(err.Error(), "does not exist") {
internal/domain/transitions.go:121: if strings.Contains(err.Error(), "does not exist") {
internal/domain/transitions.go:193: if strings.Contains(err.Error(), "does not exist") {
internal/domain/transitions.go:925: if !strings.Contains(err.Error(), "does not exist") {
internal/domain/transitions.go:1029: if !strings.Contains(err.Error(), "does not exist") {
internal/domain/transitions.go:1066: if !strings.Contains(err.Error(), "does not exist") {
internal/domain/transitions.go:1117: if strings.Contains(err.Error(), "does not exist") {
internal/domain/transitions.go:1182:
Short Description
Currently calling logic relies on errors contain "does not exist" to indicate that an entity doesn't exist. We should change this so it more explicit by returning a pointer, so it can be
nilto indicate the entity not existing.Definition of Done
The signatures are updated and the calling logic of the form
strings.Contains(err.Error(), "does not exist")is replaced withentity == nil.Additional context