// RenderStack renders the error to a list of lines.
18455
func RenderStack(err error, excludePkgs ...string) []string {
	return renderStack(err).toLines(excludePkgs...)
}
867811
func (nodeInfo *executionNode) renderNodes(w *tabwriter.Writer, wf *wfv1.Workflow, depth int, nodePrefix string, childPrefix string, outFmt string) {
	filtered, _ := filterNode(nodeInfo.getNodeStatus(wf))
	if !filtered {
		printNode(w, wf, nodeInfo.getNodeStatus(wf), depth, nodePrefix, childPrefix, outFmt)
	}
}
564887
func AttachStack(err error) {
	if err == nil {
		return
	}
	cast, ok := err.(*Error)
	if !ok {
		return
	}
	if len(cast.stacks) < 1 {
		// only record stacks if this error was supposed to
		return
	}
	cast.stacks = append(cast.stacks, getStack(2))
}
577081
func renderGodepFilesError(label string, commits []util.Commit, opt CommitFilesRenderOption) string {
	msg := fmt.Sprintf("%s:\n\n", label)
	for _, commit := range commits {
		msg += fmt.Sprintf("[%s] %s\n", commit.Sha, commit.Summary)
		if opt == RenderNoFiles {
			continue
		}
		for _, file := range commit.Files {
			if opt == RenderAllFiles ||
				(opt == RenderOnlyGodepsFiles && file.HasVendoredCodeChanges()) ||
				(opt == RenderOnlyNonGodepsFiles && !file.HasVendoredCodeChanges()) {
				msg += fmt.Sprintf("  - %s\n", file)
			}
		}
	}
	return msg
}
160186
func newSstack(setIndex setIndexCallback) *sstack {
	result := new(sstack)
	result.setIndex = setIndex
	result.active = make([]*item, blockSize)
	result.blocks = [][]*item{result.active}
	result.capacity = blockSize
	return result
}
350699
func (r *renderedStack) dumpTo(w io.Writer, excludePkgs ...string) (n int, err error) {
	excludeSet := stringset.NewFromSlice(excludePkgs...)

	return iotools.WriteTracker(w, func(w io.Writer) error {
		fmt.Fprintf(w, "goroutine %d:\n", r.goID)

		lastIdx := 0
		needNL := false
		skipCount := 0
		skipPkg := ""
		flushSkips := func(extra string) {
			if skipCount != 0 {
				if needNL {
					w.Write(nlSlice)
					needNL = false
				}
				fmt.Fprintf(w, "... skipped %d frames in pkg %q...\n%s", skipCount, skipPkg, extra)
				skipCount = 0
				skipPkg = ""
			}
		}
		for i, f := range r.frames {
			if needNL {
				w.Write(nlSlice)
				needNL = false
			}
			if excludeSet.Has(f.pkg) {
				if skipPkg == f.pkg {
					skipCount++
				} else {
					flushSkips("")
					skipCount++
					skipPkg = f.pkg
				}
				continue
			}
			flushSkips("\n")
			if len(f.wrappers) > 0 {
				f.dumpWrappersTo(w, lastIdx, i)
				w.Write(nlSlice)
			}
			if len(f.annotations) > 0 {
				lastIdx = i
				needNL = true
			}
			f.dumpTo(w, i)
		}
		flushSkips("")

		return nil
	})
}
954414
func (c *Cell) Render(style *renderStyle) (buffer string) {
	// if no alignment is set, import the table's default
	if c.alignment == nil {
		c.alignment = &style.Alignment
	}

	// left padding
	buffer += strings.Repeat(" ", style.PaddingLeft)

	// append the main value and handle alignment
	buffer += c.alignCell(style)

	// right padding
	buffer += strings.Repeat(" ", style.PaddingRight)

	// this handles escaping for, eg, Markdown, where we don't care about the
	// alignment quite as much
	if style.replaceContent != nil {
		buffer = style.replaceContent(buffer)
	}

	return buffer
}
795961
func (c *Client) ErrorWithStackSkipWithExtrasAndContext(ctx context.Context, level string, err error, skip int, extras map[string]interface{}) {
	if !c.configuration.enabled {
		return
	}
	body := c.buildBody(ctx, level, err.Error(), extras)
	addErrorToBody(c.configuration, body, err, skip)
	c.push(body)
}
397536
func (this *AsciiRender) RenderOpts(asciiStr string, opts *RenderOptions) (string, error) {
	return this.render(asciiStr, opts)
}
227355
func ErrorWithStackSkipWithExtras(level string, err error, skip int, extras map[string]interface{}) {
	std.ErrorWithStackSkipWithExtras(level, err, skip, extras)
}
1163980
func (stack ErrorStack) Error() string {
	if len(stack.errors) == 0 {
		return ""
	}

	return stack.formatter(stack.errors)
}
1162127
func ErrorWithStack(val interface{}, skip ...int) *Error {
	if IsNil(val) {
		return nil
	}

	var err *Error
	switch v := val.(type) {
	case *Error:
		err = v.WithMsg() // must clone, should not change the origin *Error instance
	case error:
		err = ErrInternalServerError.From(v)
	case string:
		err = ErrInternalServerError.WithMsg(v)
	default:
		err = ErrInternalServerError.WithMsgf("%#v", v)
	}

	if err.Stack == "" {
		buf := make([]byte, 2048)
		buf = buf[:runtime.Stack(buf, false)]
		s := 1
		if len(skip) != 0 {
			s = skip[0]
		}
		err.Stack = pruneStack(buf, s)
	}
	return err
}
1088057
func RenderError(w http.ResponseWriter) {
	data := map[string]interface{}{
		"Output": readErrorFile(),
	}

	w.Header().Set("Content-Type", "text/html")
	tpl := template.Must(template.New("ErrorPage").Parse(buildPageTpl))
	tpl.Execute(w, data)
}
1329354
func Stack(err error) []error {
	if eb, ok := err.(*errorBox); ok {
		return append([]error{eb}, Stack(eb.err)...)
	}
	return []error{err}
}
82950
func (r JSON) Render(w http.ResponseWriter) (err error) {
	if err = WriteJSON(w, r.Data); err != nil {
		panic(err)
	}
	return
}
185951
func ErrorWithStackSkipWithExtrasAndContext(ctx context.Context, level string, err error, skip int, extras map[string]interface{}) {
	std.ErrorWithStackSkipWithExtrasAndContext(ctx, level, err, skip, extras)
}
1153372
func RenderList(w http.ResponseWriter, r *http.Request, l []Renderer) error {
	for _, v := range l {
		if err := renderer(w, r, v); err != nil {
			return err
		}
	}
	Respond(w, r, l)
	return nil
}