Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor error codes #802

Merged
merged 10 commits into from
Mar 28, 2024
Next Next commit
feat: refactor error codes: generic
  • Loading branch information
slntopp committed Mar 12, 2024
commit d06a9b27aa3378ae61726df659045cef4c6c2b11
7 changes: 4 additions & 3 deletions pkg/graph/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package graph

import (
"context"
"errors"
"fmt"

"connectrpc.com/connect"
"github.com/arangodb/go-driver"
"github.com/infinimesh/infinimesh/pkg/graph/schema"
accpb "github.com/infinimesh/proto/node/accounts"
devpb "github.com/infinimesh/proto/node/devices"
nspb "github.com/infinimesh/proto/node/namespaces"
"github.com/infinimesh/proto/plugins"
"go.uber.org/zap"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

type InfinimeshProtobufEntity interface {
Expand Down Expand Up @@ -123,7 +124,7 @@ func (r *infinimeshGenericActionsRepo[T]) ListQuery(ctx context.Context, log *za
_, err = cr.ReadDocument(ctx, &resp)
if err != nil {
log.Warn("Error unmarshalling Document", zap.Error(err))
return nil, status.Error(codes.Internal, "Couldn't execute query")
return nil, connect.NewError(connect.CodeInternal, errors.New("Couldn't execute query"))
}

return &resp, nil
Expand Down
Loading