mirror of
https://github.com/pyihe/go-pkg.git
synced 2025-10-06 16:36:50 +08:00
style(go-pkg): rename package
This commit is contained in:
24
errors/error.go
Normal file
24
errors/error.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package errors
|
||||
|
||||
type Error struct {
|
||||
err string
|
||||
code int32
|
||||
}
|
||||
|
||||
func New(err string, codes ...int32) error {
|
||||
e := &Error{
|
||||
err: err,
|
||||
}
|
||||
if len(codes) > 0 {
|
||||
e.code = codes[0]
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *Error) Error() (err string) {
|
||||
return e.err
|
||||
}
|
||||
|
||||
func (e *Error) Code() int32 {
|
||||
return e.code
|
||||
}
|
Reference in New Issue
Block a user