Returns a nice formatted error string.
()
| 40 | |
| 41 | // Returns a nice formatted error string. |
| 42 | func (e *Error) Error() string { |
| 43 | s := "[Error" |
| 44 | if e.Sender != "" { |
| 45 | s += " (where: " + e.Sender + ")" |
| 46 | } |
| 47 | if e.Filename != "" { |
| 48 | s += " in " + e.Filename |
| 49 | } |
| 50 | if e.Line > 0 { |
| 51 | s += fmt.Sprintf(" | Line %d Col %d", e.Line, e.Column) |
| 52 | if e.Token != nil { |
| 53 | s += fmt.Sprintf(" near '%s'", e.Token.Val) |
| 54 | } |
| 55 | } |
| 56 | s += "] " |
| 57 | s += e.OrigError.Error() |
| 58 | return s |
| 59 | } |
| 60 | |
| 61 | // RawLine returns the affected line from the original template, if available. |
| 62 | func (e *Error) RawLine() (line string, available bool, outErr error) { |
no outgoing calls