summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/d5/tengo/compiler/error.go
blob: 6ac33d42c77fa22820837d17ad0eb34c37cc52af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package compiler

import (
	"fmt"

	"github.com/d5/tengo/compiler/ast"
	"github.com/d5/tengo/compiler/source"
)

// Error represents a compiler error.
type Error struct {
	fileSet *source.FileSet
	node    ast.Node
	error   error
}

func (e *Error) Error() string {
	filePos := e.fileSet.Position(e.node.Pos())
	return fmt.Sprintf("Compile Error: %s\n\tat %s", e.error.Error(), filePos)
}