1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
package utils
import "fmt"
type Error struct {
code int
reason string
server bool
recover bool
}
func NewError(c int, r string, s bool, rc bool) *Error {
return &Error{
code: c,
reason: r,
server: s,
recover: rc,
}
}
func (e Error) Error() string {
return fmt.Sprintf("Exception (%d) Reason: %q", e.code, e.reason)
}
func (e Error) Code() int {
return e.code
}
func (e Error) Reason() string {
return e.reason
}
func (e Error) Server() bool {
return e.server
}
func (e Error) Recover() bool {
return e.recover
}
|