MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / handleError

Function handleError

app/controlplane/pkg/data/workflowcontract.go:412–419  ·  view source on GitHub ↗

wraps the given error

(err error)

Source from the content-addressed store, hash-verified

410
411// wraps the given error
412func handleError(err error) error {
413 // If the error is a constraint error, we return a more specific error to indicate the client that's a duplicate
414 if ent.IsConstraintError(err) {
415 return biz.NewErrAlreadyExists(err)
416 }
417
418 return err
419}
420
421func latestVersion(ctx context.Context, contract *ent.WorkflowContract) (*ent.WorkflowContractVersion, error) {
422 return contract.QueryVersions().Order(ent.Desc(workflowcontractversion.FieldRevision)).First(ctx)

Callers 3

CreateMethod · 0.85
addCreateToTxMethod · 0.85
UpdateMethod · 0.85

Calls 2

IsConstraintErrorFunction · 0.92
NewErrAlreadyExistsFunction · 0.92

Tested by

no test coverage detected