-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfmt.go
27 lines (22 loc) · 876 Bytes
/
fmt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package villa
import (
"fmt"
)
// Errorf is similar to fmt.Errorf with caller's position in the source
func Errorf(format string, a ...interface{}) error {
return fmt.Errorf("%s: %s", LinePos(1), fmt.Sprintf(format, a...))
}
// Error is similar to fmt.Error with caller's position in the source
func Error(v ...interface{}) error {
return fmt.Errorf("%s: %s", LinePos(1), fmt.Sprint(v...))
}
// ErrorfN is similar to villa.Errorf with a specified line-pos depth. when n == 1, it is
// equivalent to villa.Errorf.
func ErrorfN(n int, format string, a ...interface{}) error {
return fmt.Errorf("%s: %s", LinePos(n), fmt.Sprintf(format, a...))
}
// ErrorN is similar to villa.Error with a specified line-pos depth. when n == 1, it is
// equivalent to villa.Error.
func ErrorN(n int, v ...interface{}) error {
return fmt.Errorf("%s: %s", LinePos(n), fmt.Sprint(v...))
}