package models import "fmt" type UserError struct { reason string } func NewUserError(message string, args ...interface{}) UserError { return UserError{fmt.Sprintf(message, args...)} } func (e UserError) Error() string { return e.reason }