🏗️ microservice fabric splitting
This commit is contained in:
19
common/errors/errors.go
Normal file
19
common/errors/errors.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
||||
// CodeMsg is a struct that contains a code and a message.
|
||||
// It implements the error interface.
|
||||
type CodeMsg struct {
|
||||
Code int
|
||||
Msg string
|
||||
}
|
||||
|
||||
func (c *CodeMsg) Error() string {
|
||||
return fmt.Sprintf("code: %d, msg: %s", c.Code, c.Msg)
|
||||
}
|
||||
|
||||
// New creates a new CodeMsg.
|
||||
func New(code int, msg string) error {
|
||||
return &CodeMsg{Code: code, Msg: msg}
|
||||
}
|
Reference in New Issue
Block a user