MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / render

Function render

pkg/filter/ql/error.go:98–124  ·  view source on GitHub ↗
(e *ParseError)

Source from the content-addressed store, hash-verified

96}
97
98func render(e *ParseError) string {
99 pos, ln := findPosInLine(e.Expr, e.Pos)
100 r := renderer{}
101
102 lines := strings.Split(e.Expr, "\n")
103
104 for n, line := range lines {
105 if n >= ln {
106 r.renderLineWithBorder(line)
107 } else {
108 r.renderLine(line)
109 }
110 // insert a new line and start drawing
111 // the snippet lines, gutters and borders
112 if n == ln-1 {
113 r.renderTopGutter()
114 r.renderTopBorder(pos - 1)
115 r.renderCaret()
116 }
117 r.renderNewLine()
118 }
119
120 r.renderLeftBorder()
121 r.renderLabel(18, strings.Join(e.Expected, ", "))
122
123 return r.String()
124}
125
126// Error returns the string representation of the error.
127func (e *ParseError) Error() string {

Callers 1

ErrorMethod · 0.85

Calls 10

renderLineWithBorderMethod · 0.95
renderLineMethod · 0.95
renderTopGutterMethod · 0.95
renderTopBorderMethod · 0.95
renderCaretMethod · 0.95
renderNewLineMethod · 0.95
renderLeftBorderMethod · 0.95
renderLabelMethod · 0.95
findPosInLineFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected