func Fields(err error) map[string]interface{} {
	if err == nil {
		return nil
	}
	e, ok := err.(*Error)
	if !ok {
		return nil
	}
	var fields map[string]interface{}
	if e.Cause != nil {
		causeFields := Fields(e.Cause)
		if causeFields != nil {
			fields = make(map[string]interface{}, len(e.Fields)+len(causeFields))
			for k, v := range causeFields {
				fields[k] = v
			}
		}
	}
	if e.Fields != nil {
		if fields == nil {
			fields = e.Fields
		} else {
			for k, v := range e.Fields {
				fields[k] = v
			}
		}
	}
	return fields
}
Fields returns all fields from all errors in a stack of errors, recursively checking for fields
and merging them into one map, then returning them.
package errors
import (
	"fmt"
	"sort"
)
func Fatal(err error) {
	if err == nil {
		return
	}
	wrapped := newError(err)
	updateCaller(wrapped)
	if v, ok := err.(*Error); ok {
		isFileMatch := v.file == wrapped.file
		isLineMatch := v.line == wrapped.line
		isCallerMatch := v.caller == wrapped.caller
		if isFileMatch && isLineMatch && isCallerMatch {
			wrapped = v
		}
	}
	panic(fmt.Sprintf("fatal error: %s\n\n%+v", Message(wrapped), wrapped))
}