Skip to content

Commit

Permalink
move catalog errors to errors.go (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
nopcoder committed Oct 20, 2020
1 parent 2a2a8d5 commit 3021a8a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
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

0 comments on commit 3021a8a

Please sign in to comment.