From 431070f07d094e2fa8757d27d36e7470811b7195 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Sat, 15 Jun 2024 16:01:57 -0700 Subject: [PATCH] Tell user about constraint errors for node publishing failures. --- server/implementation/registry.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/implementation/registry.go b/server/implementation/registry.go index 57c1862..f91c7a5 100644 --- a/server/implementation/registry.go +++ b/server/implementation/registry.go @@ -675,6 +675,9 @@ func (s *DripStrictServerImplementation) PublishNodeVersion( // Create node version nodeVersionCreation, err := s.RegistryService.CreateNodeVersion(ctx, s.Client, request.PublisherId, node.ID, &request.Body.NodeVersion) if err != nil { + if ent.IsConstraintError(err) { + return drip.PublishNodeVersion400JSONResponse{Message: "The node version already exists"}, nil + } errMessage := "Failed to create node version: " + err.Error() log.Ctx(ctx).Error().Msgf("Node version creation failed w/ err: %v", err) return drip.PublishNodeVersion400JSONResponse{Message: errMessage}, err