Skip to content

Commit

Permalink
solve for lower golang versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hedzr committed Dec 13, 2023
1 parent e0fb285 commit 808fb6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions coded.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,19 @@ const (
IllegalFormat Code = -25

// IllegalArgument is like InvalidArgument but applied on application.
IllegalArgument = -26
IllegalArgument Code = -26

// InitializationFailed is used for application start up unsuccessfully.
InitializationFailed = -27
InitializationFailed Code = -27

// DataUnavailable is used for the data fetching failed.
DataUnavailable = -28
DataUnavailable Code = -28

// UnsupportedOperation is like MethodNotAllowed but applied on application.
UnsupportedOperation = -29
UnsupportedOperation Code = -29

// UnsupportedVersion can be used for production continuously iteration.
UnsupportedVersion = -30
UnsupportedVersion Code = -30

// MinErrorCode is the lower bound for user-defined Code.
MinErrorCode Code = -1000
Expand Down
4 changes: 3 additions & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func New(args ...interface{}) Error { //nolint:revive
//
// var err1 = errors.New("message") // simple message
// var err1 = errors.New(errors.WithStack(cause)) // return Error object with Opt
//
// If no send any args as parameters, Code `UnsupportedOperation` returned.
func NewLite(args ...interface{}) error { //nolint:revive
if len(args) > 0 {
if message, ok := args[0].(string); ok {
Expand All @@ -65,7 +67,7 @@ func NewLite(args ...interface{}) error { //nolint:revive
}
return s.Build()
}
return errors.ErrUnsupported
return UnsupportedOperation // errors.ErrUnsupported
}

// Opt _
Expand Down

0 comments on commit 808fb6f

Please sign in to comment.