func (f *Friendly) WithSecure(secureMsg string, fields ...Fields) *Friendly {
	return &Friendly{
		secureMsg:   secureMsg,
		msg:         f.msg,
		friendlyMsg: f.friendlyMsg,
		fields:      combineFields(append([]Fields{f.fields}, fields...)...),
	}
}
WithSecure returns a copy of err where the SecureError() is set to secureMsg.
package errors
const DefaultFriendlyError = "An error occurred"
type Fields map[string]interface{}
type Friendly struct {
	msg         string
	friendlyMsg string
	secureMsg   string
	fields      Fields
}
func New(msg string, fields ...Fields) *Friendly {
	return &Friendly{
		msg:    msg,
		fields: combineFields(fields...),
	}
}
func NewFriendly(friendlyMsg string, fields ...Fields) *Friendly {
	return &Friendly{
		friendlyMsg: friendlyMsg,
		fields:      combineFields(fields...),
	}
}
func NewSecure(secureMsg string, fields ...Fields) *Friendly {
	return &Friendly{
		secureMsg: secureMsg,
		fields:    combineFields(fields...),
	}
}
func NewWrapped(err error, fields ...Fields) error {
	if err == nil {
		return nil
	}
	return New(err.Error(), fields...)
}
func combineFields(fields ...Fields) Fields {
	var result = make(Fields)
	for _, field := range fields {
		for key, val := range field {
			result[key] = val
		}
	}
	return result
}
func (f *Friendly) SecureError() string {
	if f.secureMsg == "" {
		return f.Error()
	}
	return f.secureMsg
}
func (f *Friendly) Error() string {
	if f.msg == "" {
		return f.FriendlyError()
	}
	return f.msg
}
func (f *Friendly) FriendlyError() string {
	if f.friendlyMsg == "" {
		return DefaultFriendlyError
	}
	return f.friendlyMsg
}
func (f *Friendly) Fields() Fields {
	return f.fields
}
func Extend(err error, msg string, fields ...Fields) *Friendly {
	var base *Friendly
	if f, ok := err.(*Friendly); ok {
		base = f
	}
	if base == nil {
		base = New(err.Error())
	}
	return &Friendly{
		secureMsg:   base.secureMsg,
		friendlyMsg: base.friendlyMsg,
		msg:         msg + " : " + base.Error(),
		fields:      combineFields(append([]Fields{base.fields}, fields...)...),
	}
}
func (f *Friendly) WithFriendly(friendlyMsg string, fields ...Fields) *Friendly {
	return &Friendly{
		secureMsg:   f.secureMsg,
		msg:         f.msg,
		friendlyMsg: friendlyMsg,
		fields:      combineFields(append([]Fields{f.fields}, fields...)...),
	}
}
func (f *Friendly) WithError(msg string, fields ...Fields) *Friendly {
	return &Friendly{
		secureMsg:   f.secureMsg,
		msg:         msg,
		friendlyMsg: f.friendlyMsg,
		fields:      combineFields(append([]Fields{f.fields}, fields...)...),
	}
}