Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
improve standard of the document
Browse files Browse the repository at this point in the history
Signed-off-by: chentanjun <[email protected]>
  • Loading branch information
tanjunchen committed Sep 17, 2019
1 parent 4dffe50 commit 2f03037
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions pkg/errortypes/errortypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,37 +90,37 @@ func (s DfError) Error() string {
return fmt.Sprintf("{\"Code\":%d,\"Msg\":\"%s\"}", s.Code, s.Msg)
}

// IsNilError check the error is nil or not.
// IsNilError checks the error is nil or not.
func IsNilError(err error) bool {
return err == nil
}

// IsDataNotFound check the error is the data cannot be found.
// IsDataNotFound checks the error is the data cannot be found.
func IsDataNotFound(err error) bool {
return checkError(err, codeDataNotFound)
}

// IsEmptyValue check the error is the value is empty or nil.
// IsEmptyValue checks the error is the value is empty or nil.
func IsEmptyValue(err error) bool {
return checkError(err, codeEmptyValue)
}

// IsInvalidValue check the error is the value is invalid or not.
// IsInvalidValue checks the error is the value is invalid or not.
func IsInvalidValue(err error) bool {
return checkError(err, codeInvalidValue)
}

// IsNotInitialized check the error is the object is not initialized or not.
// IsNotInitialized checks the error is the object is not initialized or not.
func IsNotInitialized(err error) bool {
return checkError(err, codeNotInitialized)
}

// IsConvertFailed check the error is a conversion error or not.
// IsConvertFailed checks the error is a conversion error or not.
func IsConvertFailed(err error) bool {
return checkError(err, codeConvertFailed)
}

// IsRangeNotSatisfiable check the error is a
// IsRangeNotSatisfiable checks the error is a
// range not exist error or not.
func IsRangeNotSatisfiable(err error) bool {
return checkError(err, codeRangeNotSatisfiable)
Expand Down
18 changes: 9 additions & 9 deletions pkg/errortypes/supernode_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,47 +47,47 @@ var (
ErrAuthenticationRequired = DfError{codeAuthenticationRequired, "authentication required"}
)

// IsSystemError check the error is a system error or not.
// IsSystemError checks the error is a system error or not.
func IsSystemError(err error) bool {
return checkError(err, codeSystemError)
}

// IsCDNFail check the error is CDNFail or not.
// IsCDNFail checks the error is CDNFail or not.
func IsCDNFail(err error) bool {
return checkError(err, codeCDNFail)
}

// IsCDNWait check the error is CDNWait or not.
// IsCDNWait checks the error is CDNWait or not.
func IsCDNWait(err error) bool {
return checkError(err, codeCDNWait)
}

// IsPeerWait check the error is PeerWait or not.
// IsPeerWait checks the error is PeerWait or not.
func IsPeerWait(err error) bool {
return checkError(err, codePeerWait)
}

// IsUnknowError check the error is UnknowError or not.
// IsUnknowError checks the error is UnknowError or not.
func IsUnknowError(err error) bool {
return checkError(err, codeUnknowError)
}

// IsPeerContinue check the error is PeerContinue or not.
// IsPeerContinue checks the error is PeerContinue or not.
func IsPeerContinue(err error) bool {
return checkError(err, codePeerContinue)
}

// IsURLNotReachable check the error is a url not reachable or not.
// IsURLNotReachable checks the error is a url not reachable or not.
func IsURLNotReachable(err error) bool {
return checkError(err, codeURLNotReachable)
}

// IsTaskIDDuplicate check the error is a TaskIDDuplicate error or not.
// IsTaskIDDuplicate checks the error is a TaskIDDuplicate error or not.
func IsTaskIDDuplicate(err error) bool {
return checkError(err, codeTaskIDDuplicate)
}

// IsAuthenticationRequired check the error is an AuthenticationRequired error or not.
// IsAuthenticationRequired checks the error is an AuthenticationRequired error or not.
func IsAuthenticationRequired(err error) bool {
return checkError(err, codeAuthenticationRequired)
}
2 changes: 1 addition & 1 deletion pkg/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
Printer = &StdPrinter{Out: os.Stdout}
)

// StdPrinter output info to console directly.
// StdPrinter outputs info to console directly.
type StdPrinter struct {
Out io.Writer
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/syncmap/syncmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NewSyncMap() *SyncMap {
return &SyncMap{&sync.Map{}}
}

// Add add a key-value pair into the *sync.Map.
// Add adds a key-value pair into the *sync.Map.
// The ErrEmptyValue error will be returned if the key is empty.
func (mmap *SyncMap) Add(key string, value interface{}) error {
if stringutils.IsEmptyStr(key) {
Expand Down

0 comments on commit 2f03037

Please sign in to comment.