diff --git a/coded.go b/coded.go index d400d91..6c2ddd4 100644 --- a/coded.go +++ b/coded.go @@ -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 diff --git a/errors.go b/errors.go index 05f810d..33e9187 100644 --- a/errors.go +++ b/errors.go @@ -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 { @@ -65,7 +67,7 @@ func NewLite(args ...interface{}) error { //nolint:revive } return s.Build() } - return errors.ErrUnsupported + return UnsupportedOperation // errors.ErrUnsupported } // Opt _