mirror of
https://github.com/pyihe/go-pkg.git
synced 2025-10-05 16:06:58 +08:00
feature(pkg): modify
add func, remove rediss
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Error struct {
|
||||
err string
|
||||
code int32
|
||||
@@ -16,7 +18,10 @@ func New(err string, codes ...int32) error {
|
||||
}
|
||||
|
||||
func (e *Error) Error() (err string) {
|
||||
return e.err
|
||||
if e.code == 0 {
|
||||
return e.err
|
||||
}
|
||||
return fmt.Sprintf("%d-%s", e.code, e.err)
|
||||
}
|
||||
|
||||
func (e *Error) Code() int32 {
|
||||
|
Reference in New Issue
Block a user