errors/cause.go
func Cause(err Error) error {
	attributes := err.Attributes()
	if attributes == nil {
		return nil
	}

	cause, ok := attributes[causeKey]
	if !ok {
		return nil
	}

	switch v := cause.(type) {
	case error:
		return v
	case string:
		return errors.New(v)
	default:
		return nil
	}
}
func Cause(err Error) error {
	attributes := err.Attributes()
	if attributes == nil {
		return nil
	}

	cause, ok := attributes[causeKey]
	if !ok {
		return nil
	}

	switch v := cause.(type) {
	case error:
		return v
	case string:
		return errors.New(v)
	default:
		return nil
	}
}
// Cause returns the cause of an error