23 lines
345 B
Go
23 lines
345 B
Go
package errors
|
|
|
|
import "fmt"
|
|
|
|
type CustomError struct {
|
|
Message string
|
|
Status int
|
|
}
|
|
|
|
func (e *CustomError) Error() string {
|
|
return e.Message
|
|
}
|
|
func (e *CustomError) Err() error {
|
|
return fmt.Errorf(e.Message)
|
|
}
|
|
|
|
func NewCustomError(message string, status int) *CustomError {
|
|
return &CustomError{
|
|
Message: message,
|
|
Status: status,
|
|
}
|
|
}
|