Skip to content

Commit 22c698e

Browse files
committed
chore: remove unused code
1 parent fc00ee0 commit 22c698e

2 files changed

Lines changed: 0 additions & 61 deletions

File tree

internal/graph/errors.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"
1212

13-
"github.com/authzed/spicedb/internal/sharederrors"
1413
dispatch "github.com/authzed/spicedb/pkg/proto/dispatch/v1"
1514
"github.com/authzed/spicedb/pkg/spiceerrors"
1615
)
@@ -62,46 +61,6 @@ func NewAlwaysFailErr() error {
6261
}
6362
}
6463

65-
// RelationNotFoundError occurs when a relation was not found under a namespace.
66-
type RelationNotFoundError struct {
67-
error
68-
namespaceName string
69-
relationName string
70-
}
71-
72-
// NamespaceName returns the name of the namespace in which the relation was not found.
73-
func (err RelationNotFoundError) NamespaceName() string {
74-
return err.namespaceName
75-
}
76-
77-
// NotFoundRelationName returns the name of the relation not found.
78-
func (err RelationNotFoundError) NotFoundRelationName() string {
79-
return err.relationName
80-
}
81-
82-
func (err RelationNotFoundError) MarshalZerologObject(e *zerolog.Event) {
83-
e.Err(err.error).Str("namespace", err.namespaceName).Str("relation", err.relationName)
84-
}
85-
86-
// DetailsMetadata returns the metadata for details for this error.
87-
func (err RelationNotFoundError) DetailsMetadata() map[string]string {
88-
return map[string]string{
89-
"definition_name": err.namespaceName,
90-
"relation_or_permission_name": err.relationName,
91-
}
92-
}
93-
94-
// NewRelationNotFoundErr constructs a new relation not found error.
95-
func NewRelationNotFoundErr(nsName string, relationName string) error {
96-
return RelationNotFoundError{
97-
error: fmt.Errorf("relation/permission `%s` not found under definition `%s`", relationName, nsName),
98-
namespaceName: nsName,
99-
relationName: relationName,
100-
}
101-
}
102-
103-
var _ sharederrors.UnknownRelationError = RelationNotFoundError{}
104-
10564
// RelationMissingTypeInfoError defines an error for when type information is missing from a relation
10665
// during a lookup.
10766
type RelationMissingTypeInfoError struct {

internal/graph/errors_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,6 @@ func TestAlwaysFailError(t *testing.T) {
4141
require.Equal(t, "always fail", err.Error())
4242
}
4343

44-
func TestRelationNotFoundError(t *testing.T) {
45-
err := NewRelationNotFoundErr("document", "viewer")
46-
47-
var rnfe RelationNotFoundError
48-
require.ErrorAs(t, err, &rnfe)
49-
require.Equal(t, "document", rnfe.NamespaceName())
50-
require.Equal(t, "viewer", rnfe.NotFoundRelationName())
51-
require.Contains(t, err.Error(), "viewer")
52-
require.Contains(t, err.Error(), "document")
53-
54-
require.Equal(t, map[string]string{
55-
"definition_name": "document",
56-
"relation_or_permission_name": "viewer",
57-
}, rnfe.DetailsMetadata())
58-
59-
require.NotPanics(t, func() {
60-
rnfe.MarshalZerologObject(zerolog.Dict())
61-
})
62-
}
63-
6444
func TestRelationMissingTypeInfoError(t *testing.T) {
6545
err := NewRelationMissingTypeInfoErr("document", "viewer")
6646

0 commit comments

Comments
 (0)