-
Notifications
You must be signed in to change notification settings - Fork 1
/
error.go
40 lines (31 loc) · 868 Bytes
/
error.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
28
29
30
31
32
33
34
35
36
37
38
39
40
package fluentbitconfig
import (
"errors"
"fmt"
)
var ErrMissingName = errors.New("missing name property")
// LinedError with information about the line number
// where the error was found while parsing.
type LinedError struct {
Msg string
Line uint
}
func (e *LinedError) Error() string {
return fmt.Sprintf("%d: %s", e.Line, e.Msg)
}
func NewLinedError(msg string, line uint) *LinedError {
return &LinedError{Msg: msg, Line: line}
}
func WrapLinedError(err error, line uint) *LinedError {
return &LinedError{Msg: err.Error(), Line: line}
}
type UnknownPluginError struct {
Kind SectionKind
Name string
}
func NewUnknownPluginError(kind SectionKind, name string) *UnknownPluginError {
return &UnknownPluginError{Kind: kind, Name: name}
}
func (e *UnknownPluginError) Error() string {
return fmt.Sprintf("%s: unknown plugin %q", e.Kind, e.Name)
}