func ParamFromError(err error, key string) (value interface{}, safe bool) {
	visitErrorParams(err, func(k string, v interface{}, s bool) {
		if k == key {
			value = v
			safe = s
		}
	})
	return value, safe
}
ParamFromError returns the value of the parameter for the given key, or nil if no such key exists. Checks the
parameters of the provided error and all of its causes. If the error and its causes contain multiple values for the
same key, the most specific (deepest) value will be returned.
package werror
import (
	"context"
	"fmt"
	wparams "github.com/palantir/witchcraft-go-params"
)
var _ Werror = (*werror)(nil)
func Error(msg string, params ...Param) error {
	return newWerror(msg, nil, params...)
}
func ErrorWithContextParams(ctx context.Context, msg string, params ...Param) error {
	safe, unsafe := wparams.SafeAndUnsafeParamsFromContext(ctx)
	fullParams := []Param{
		SafeParams(safe),
		UnsafeParams(unsafe),
	}
	fullParams = append(fullParams, params...)
	return newWerror(msg, nil, fullParams...)
}
func Wrap(err error, msg string, params ...Param) error {
	if err == nil {
		return nil
	}
	return newWerror(msg, err, params...)
}
func WrapWithContextParams(ctx context.Context, err error, msg string, params ...Param) error {
	if err == nil {
		return nil
	}
	safe, unsafe := wparams.SafeAndUnsafeParamsFromContext(ctx)
	fullParams := []Param{
		SafeParams(safe),
		UnsafeParams(unsafe),
	}
	fullParams = append(fullParams, params...)
	return newWerror(msg, err, fullParams...)
}
func Convert(err error) error {
	if err == nil {
		return err
	}
	switch err.(type) {
	case Werror:
		return err
	default:
		return newWerror("", err)
	}
}
func RootCause(err error) error {
	for {
		causer, ok := err.(Causer)
		if !ok {
			return err
		}
		cause := causer.Cause()
		if cause == nil {
			return err
		}
		err = cause
	}
}
func ParamsFromError(err error) (safeParams map[string]interface{}, unsafeParams map[string]interface{}) {
	safeParams = make(map[string]interface{})
	unsafeParams = make(map[string]interface{})
	if err != nil {
		visitErrorParams(err, func(k string, v interface{}, safe bool) {
			if safe {
				safeParams[k] = v
			} else {
				unsafeParams[k] = v
			}
		})
	}
	return safeParams, unsafeParams
}