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

move catalog errors definition into errors file #847

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions catalog/cataloger_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ type diffResultsBatchWriter struct {
Records []*diffResultRecord
}

var ErrMissingDiffResultsIDInContext = errors.New("missing diff results id in context")

// Diff lists of differences between leftBranch and rightBranch.
// The second return value will be true if there are more results. Use the last entry's path as the next call to Diff in the 'after' argument.
// limit - is the maximum number of differences we will return, limited by DiffMaxLimit (which will be used in case limit less than 0)
Expand Down
38 changes: 20 additions & 18 deletions catalog/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ import (
)

var (
ErrFeatureNotSupported = errors.New("feature not supported")
ErrOperationNotPermitted = errors.New("operation not permitted")
ErrInvalidLockValue = errors.New("invalid lock value")
ErrNothingToCommit = errors.New("nothing to commit")
ErrNoDifferenceWasFound = errors.New("no difference was found")
ErrConflictFound = errors.New("conflict found")
ErrUnsupportedRelation = errors.New("unsupported relation")
ErrUnsupportedDelimiter = errors.New("unsupported delimiter")
ErrInvalidReference = errors.New("invalid reference")
ErrBranchNotFound = fmt.Errorf("branch %w", db.ErrNotFound)
ErrCommitNotFound = fmt.Errorf("commit %w", db.ErrNotFound)
ErrRepositoryNotFound = fmt.Errorf("repository %w", db.ErrNotFound)
ErrMultipartUploadNotFound = fmt.Errorf("multipart upload %w", db.ErrNotFound)
ErrEntryNotFound = fmt.Errorf("entry %w", db.ErrNotFound)
ErrByteSliceTypeAssertion = errors.New("type assertion to []byte failed")
ErrInvalidMetadataSrcFormat = errors.New("invalid metadata src format")
ErrUnexpected = errors.New("unexpected error")
ErrReadEntryTimeout = errors.New("read entry timeout")
ErrFeatureNotSupported = errors.New("feature not supported")
ErrOperationNotPermitted = errors.New("operation not permitted")
ErrInvalidLockValue = errors.New("invalid lock value")
ErrNothingToCommit = errors.New("nothing to commit")
ErrNoDifferenceWasFound = errors.New("no difference was found")
ErrConflictFound = errors.New("conflict found")
ErrUnsupportedRelation = errors.New("unsupported relation")
ErrUnsupportedDelimiter = errors.New("unsupported delimiter")
ErrInvalidReference = errors.New("invalid reference")
ErrBranchNotFound = fmt.Errorf("branch %w", db.ErrNotFound)
ErrCommitNotFound = fmt.Errorf("commit %w", db.ErrNotFound)
ErrRepositoryNotFound = fmt.Errorf("repository %w", db.ErrNotFound)
ErrMultipartUploadNotFound = fmt.Errorf("multipart upload %w", db.ErrNotFound)
ErrEntryNotFound = fmt.Errorf("entry %w", db.ErrNotFound)
ErrByteSliceTypeAssertion = errors.New("type assertion to []byte failed")
ErrInvalidMetadataSrcFormat = errors.New("invalid metadata src format")
ErrUnexpected = errors.New("unexpected error")
ErrReadEntryTimeout = errors.New("read entry timeout")
ErrMissingDiffResultsIDInContext = errors.New("missing diff results id in context")
ErrInvalidValue = errors.New("invalid value")
)
3 changes: 0 additions & 3 deletions catalog/validate.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package catalog

import (
"errors"
"fmt"
"regexp"
)

var (
ErrInvalidValue = errors.New("invalid value")

validBranchNameRegexp = regexp.MustCompile(`^\w[-\w]*$`)
validRepositoryNameRegexp = regexp.MustCompile(`^[a-z0-9][a-z0-9-]{2,62}$`)
)
Expand Down