From 1432dd2d5bf784cc065eae364f05987ad2e863d5 Mon Sep 17 00:00:00 2001 From: Barak Amar Date: Tue, 20 Oct 2020 13:10:36 +0300 Subject: [PATCH] move catalog errors to errors.go --- catalog/cataloger_diff.go | 2 -- catalog/errors.go | 38 ++++++++++++++++++++------------------ catalog/validate.go | 3 --- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/catalog/cataloger_diff.go b/catalog/cataloger_diff.go index 5b7f9b98518..8b2f6617006 100644 --- a/catalog/cataloger_diff.go +++ b/catalog/cataloger_diff.go @@ -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) diff --git a/catalog/errors.go b/catalog/errors.go index acd54729773..828cf0064e1 100644 --- a/catalog/errors.go +++ b/catalog/errors.go @@ -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") ) diff --git a/catalog/validate.go b/catalog/validate.go index 3716a1a516e..4c8f6dfe738 100644 --- a/catalog/validate.go +++ b/catalog/validate.go @@ -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}$`) )