func (err *cmnError) Stacktrace() Error {
	if err.stacktrace == nil {
		var offset = 3
		var depth = 32
		err.stacktrace = captureStacktrace(offset, depth)
	}
	return err
}
Captures a stacktrace if one was not already captured.
package common
import (
	"fmt"
	"runtime"
)
func ErrorWrap(cause interface{}, format string, args ...interface{}) Error {
	if causeCmnError, ok := cause.(*cmnError); ok {
		msg := Fmt(format, args...)
		return causeCmnError.Stacktrace().Trace(1, msg)
	} else if cause == nil {
		return newCmnError(FmtError{format, args}).Stacktrace()
	} else {
		msg := Fmt(format, args...)
		return newCmnError(cause).Stacktrace().Trace(1, msg)
	}
}
type Error interface {
	Error() string
	Stacktrace() Error
	Trace(offset int, format string, args ...interface{}) Error
	Data() interface{}
}
func NewError(format string, args ...interface{}) Error {
	err := FmtError{format, args}
	return newCmnError(err)
}
func NewErrorWithData(data interface{}) Error {
	return newCmnError(data)
}
type cmnError struct {
	data       interface{}     
	msgtraces  []msgtraceItem  
	stacktrace []uintptr       
}
var _ Error = &cmnError{}
func newCmnError(data interface{}) *cmnError {
	return &cmnError{
		data:       data,
		msgtraces:  nil,
		stacktrace: nil,
	}
}
func (err *cmnError) Error() string {
	return fmt.Sprintf("%v", err)
}