Skip to content

Commit

Permalink
fix: only log internal errors as errors (#1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-urbanski-freiheit-com authored Feb 26, 2024
1 parent f207406 commit 186805c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/grpc/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ func InternalError(ctx context.Context, err error) error {
return status.Error(codes.Internal, "internal error")
}

func PublicError(ctx context.Context, err error) error {
logger := logger.FromContext(ctx)
logger.Error("grpc.public", zap.Error(err))
func PublicError(_ context.Context, err error) error {
return status.Error(codes.InvalidArgument, "error: "+err.Error())
}

Expand All @@ -49,8 +47,6 @@ func AuthError(_ context.Context, err error) error {
return status.Error(codes.Unauthenticated, "error: "+err.Error())
}

func NotFoundError(ctx context.Context, err error) error {
logger := logger.FromContext(ctx)
logger.Error("grpc.public", zap.Error(err))
func NotFoundError(_ context.Context, err error) error {
return status.Error(codes.NotFound, "error: "+err.Error())
}
}

0 comments on commit 186805c

Please sign in to comment.