Skip to content

Commit

Permalink
Make implementations return not-implemented error
Browse files Browse the repository at this point in the history
  • Loading branch information
islamaliev committed Mar 7, 2024
1 parent 669f247 commit b89c0a2
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 15 deletions.
6 changes: 3 additions & 3 deletions http/client_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,13 @@ func (c *Collection) GetIndexes(ctx context.Context) ([]client.IndexDescription,
}

func (c *Collection) CreateDocIndex(context.Context, *client.Document) error {
return nil
return ErrMethodIsNotImplemented
}

func (c *Collection) UpdateDocIndex(ctx context.Context, oldDoc, newDoc *client.Document) error {
return nil
return ErrMethodIsNotImplemented
}

func (c *Collection) DeleteDocIndex(context.Context, *client.Document) error {
return nil
return ErrMethodIsNotImplemented
}
20 changes: 11 additions & 9 deletions http/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,24 @@ import (
)

const (
errFailedToLoadKeys string = "failed to load given keys"
errFailedToLoadKeys string = "failed to load given keys"
errMethodIsNotImplemented string = "the method is not implemented"
)

// Errors returnable from this package.
//
// This list is incomplete. Undefined errors may also be returned.
// Errors returned from this package may be tested against these errors with errors.Is.
var (
ErrNoListener = errors.New("cannot serve with no listener")
ErrNoEmail = errors.New("email address must be specified for tls with autocert")
ErrInvalidRequestBody = errors.New("invalid request body")
ErrStreamingNotSupported = errors.New("streaming not supported")
ErrMigrationNotFound = errors.New("migration not found")
ErrMissingRequest = errors.New("missing request")
ErrInvalidTransactionId = errors.New("invalid transaction id")
ErrP2PDisabled = errors.New("p2p network is disabled")
ErrNoListener = errors.New("cannot serve with no listener")
ErrNoEmail = errors.New("email address must be specified for tls with autocert")
ErrInvalidRequestBody = errors.New("invalid request body")
ErrStreamingNotSupported = errors.New("streaming not supported")
ErrMigrationNotFound = errors.New("migration not found")
ErrMissingRequest = errors.New("missing request")
ErrInvalidTransactionId = errors.New("invalid transaction id")
ErrP2PDisabled = errors.New("p2p network is disabled")
ErrMethodIsNotImplemented = errors.New(errMethodIsNotImplemented)
)

type errorResponse struct {
Expand Down
24 changes: 24 additions & 0 deletions tests/clients/cli/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2024 Democratized Data Foundation
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package cli

import (
"github.com/sourcenetwork/defradb/errors"
)

const (
errMethodIsNotImplemented string = "the method is not implemented"
)

// Errors returnable from this package.
var (
ErrMethodIsNotImplemented = errors.New(errMethodIsNotImplemented)
)
6 changes: 3 additions & 3 deletions tests/clients/cli/wrapper_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,13 @@ func (c *Collection) GetIndexes(ctx context.Context) ([]client.IndexDescription,
}

func (c *Collection) CreateDocIndex(context.Context, *client.Document) error {
return nil
return ErrMethodIsNotImplemented
}

func (c *Collection) UpdateDocIndex(ctx context.Context, oldDoc, newDoc *client.Document) error {
return nil
return ErrMethodIsNotImplemented
}

func (c *Collection) DeleteDocIndex(context.Context, *client.Document) error {
return nil
return ErrMethodIsNotImplemented
}

0 comments on commit b89c0a2

Please sign in to comment.