// Stack enables stack trace printing for the error passed to Err().
//
// ErrorStackMarshaler must be set for this method to do something.
168786
func (e *Event) Stack() *Event {
	if e != nil {
		e.stack = true
	}
	return e
}
203346
func (e Error) StackTraceString() string {
	buf := new(bytes.Buffer)
	for _, v := range e.Stack {
		fmt.Fprintf(buf, "%s: %s\n\t%s\n", v.File, v.Number, v.Method)
	}
	return string(buf.Bytes())
}
1148212
func Wrap(err error, code string, message string) error {
	if err == nil {
		return nil
	}
	err = errors.Wrap(err, message)
	return argoerr{code, message, err.(stackTracer)}
}
651559
func stacktrace() []string {
	ret := make([]string, 0, 2)

	for skip := 2; skip < maxStackFrames; skip++ {
		_, file, line, ok := runtime.Caller(skip)
		if !ok {
			break
		}

		ret = append(ret, fmt.Sprintf("at %s:%d", stripDirectories(file, 1), line))
	}

	return ret
}
1343839
func NewStack(skip int, message string) Composer {
	return &stackMessage{
		trace:    captureStack(skip),
		Composer: NewString(message),
	}
}
962485
func Wrap(err error, message string) error {
	if err == nil {
		return nil
	}
	return &wrapping{
		cause: err,
		msg:   message,
		stack: callers(),
	}
}
674366
func ErrorWithStackSkip(level string, err error, skip int) {
	std.ErrorWithStackSkip(level, err, skip)
}
807638
func WithStacks(err error) error {
	if err == nil {
		// Remain no-error.
		return nil
	}
	if _, ok := err.(*ErrorWithStacks); ok {
		// If err has been an ErrorWithStacks, no need to wrap it.
		return err
	}
	return &ErrorWithStacks{
		Err:    err,
		Stacks: stacks(2),
	}
}
1204345
func Trace(err error) error {
	if err == nil {
		return nil
	}

	buf := make([]byte, 1024)
	sz := runtime.Stack(buf, false)

	return &TraceError{
		error: err,
		trace: string(buf[:sz]),
	}
}
1166973
func (stack *ErrorStack) Push(err error) bool {
	if err != nil {
		stack.errors = append(stack.errors, err)
		return true
	}
	return false
}
410531
func LogStack() {
	buf := make([]byte, 1<<20)
	stacklen := runtime.Stack(buf, true)
	log.Infof("*** goroutine dump...\n%s\n*** end\n", buf[:stacklen])
}
600630
func (self *Stack) ExportStack() (string, error) {

	url := "stack/" + self.Uuid + "/export/"
	request := "GET"
	//Empty Body Request
	body := []byte(`{}`)

	data, err := TutumCall(url, request, body)
	if err != nil {
		return "", err
	}

	s := string(data)

	return s, nil
}
802268
func StackTrace(err error) (errors.StackTrace, bool) {
	st, ok := getStackTracer(err)
	if ok {
		return st.StackTrace(), true
	}

	return nil, false
}
633494
func NewStack() (o Stack) {
	var i = &StackItem{}
	for _, line := range bytes.Split(DebugStack(), byteLineDelimiter) {
		// Trim line
		line = bytes.TrimSpace(line)

		// Check line type
		var r [][]string
		if r = regexpFunction.FindAllStringSubmatch(string(line), -1); len(r) > 0 && len(r[0]) > 1 {
			i.Function = r[0][1]
		} else if r = regexpFile.FindAllStringSubmatch(string(line), -1); len(r) > 0 && len(r[0]) > 2 {
			i.Filename = r[0][1]
			i.Line, _ = strconv.Atoi(r[0][2])
			o = append(o, *i)
			i = &StackItem{}
		}
	}
	return
}
1352125
func Wrap(err error, message string) error {
	if err == nil {
		return nil
	}
	err = &withMessage{
		cause: err,
		msg:   message,
	}
	return &withStack{
		err,
		stack.New(1),
	}
}
1122580
func Current(stack stackTrace) {
	rawStack := make([]byte, 1<<16)
	rawStack = rawStack[:runtime.Stack(rawStack, false)]
	Parse(rawStack, stack)
}
1186600
func (req *PostRequest) SetStackTrace(t stack.Trace) {
	req.Details.Error.StackTrace = t
}