MCPcopy Index your code
hub / github.com/alecthomas/participle / FormatError

Function FormatError

error.go:23–38  ·  view source on GitHub ↗

FormatError formats an error in the form "[ :][ : :] "

(err Error)

Source from the content-addressed store, hash-verified

21
22// FormatError formats an error in the form "[<filename>:][<line>:<pos>:] <message>"
23func FormatError(err Error) string {
24 msg := ""
25 pos := err.Position()
26 if pos.Filename != "" {
27 msg += pos.Filename + ":"
28 }
29 if pos.Line != 0 || pos.Column != 0 {
30 msg += fmt.Sprintf("%d:%d:", pos.Line, pos.Column)
31 }
32 if msg != "" {
33 msg += " " + err.Message()
34 } else {
35 msg = err.Message()
36 }
37 return msg
38}
39
40// UnexpectedTokenError is returned by Parse when an unexpected token is encountered.
41//

Callers 2

ErrorMethod · 0.85
ErrorMethod · 0.85

Calls 2

PositionMethod · 0.65
MessageMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…