Skip to content

Commit

Permalink
Tell user about constraint errors for node publishing failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang committed Jun 15, 2024
1 parent a78370e commit 431070f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/implementation/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 431070f

Please sign in to comment.