Drop unreachable no-targets error handlers
The single-resource access resolvers each forward exactly one hard-coded id, so RequestPortalAccess never returns ErrNoAccessTargets on those paths — it only does so when all three id slices are empty. Remove the three dead handlers, keeping the live one on the bulk path where the resolved id slices can legitimately all be empty. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -974,11 +974,8 @@ func (r *mutationResolver) RequestDocumentAccess(ctx context.Context, input type
|
|||||||
CompliancePortalFileIDs: []gid.GID{},
|
CompliancePortalFileIDs: []gid.GID{},
|
||||||
},
|
},
|
||||||
); err != nil {
|
); err != nil {
|
||||||
if errors.Is(err, visitor.ErrNoAccessTargets) {
|
|
||||||
return nil, gqlutils.Invalidf(ctx, "at least one document, report, or file id is required")
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot request document access", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot request document access", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1000,6 +997,7 @@ func (r *mutationResolver) RequestReportAccess(ctx context.Context, input types.
|
|||||||
}
|
}
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot load audit", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot load audit", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1032,11 +1030,8 @@ func (r *mutationResolver) RequestReportAccess(ctx context.Context, input types.
|
|||||||
CompliancePortalFileIDs: []gid.GID{},
|
CompliancePortalFileIDs: []gid.GID{},
|
||||||
},
|
},
|
||||||
); err != nil {
|
); err != nil {
|
||||||
if errors.Is(err, visitor.ErrNoAccessTargets) {
|
|
||||||
return nil, gqlutils.Invalidf(ctx, "at least one document, report, or file id is required")
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot request report access", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot request report access", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1084,11 +1079,8 @@ func (r *mutationResolver) RequestCompliancePortalFileAccess(ctx context.Context
|
|||||||
CompliancePortalFileIDs: []gid.GID{input.CompliancePortalFileID},
|
CompliancePortalFileIDs: []gid.GID{input.CompliancePortalFileID},
|
||||||
},
|
},
|
||||||
); err != nil {
|
); err != nil {
|
||||||
if errors.Is(err, visitor.ErrNoAccessTargets) {
|
|
||||||
return nil, gqlutils.Invalidf(ctx, "at least one document, report, or file id is required")
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot request compliance portal file access", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot request compliance portal file access", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user