diff options
Diffstat (limited to 'vendor/gopkg.in/gcfg.v1/errors.go')
| -rw-r--r-- | vendor/gopkg.in/gcfg.v1/errors.go | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/vendor/gopkg.in/gcfg.v1/errors.go b/vendor/gopkg.in/gcfg.v1/errors.go index 853c76021..83a591dac 100644 --- a/vendor/gopkg.in/gcfg.v1/errors.go +++ b/vendor/gopkg.in/gcfg.v1/errors.go @@ -1,8 +1,6 @@ package gcfg -import ( - "gopkg.in/warnings.v0" -) +import warnings "gopkg.in/warnings.v0" // FatalOnly filters the results of a Read*Into invocation and returns only // fatal errors. That is, errors (warnings) indicating data for unknown @@ -21,21 +19,39 @@ func isFatal(err error) bool { return !ok } -type extraData struct { +type loc struct { section string subsection *string variable *string } -func (e extraData) Error() string { - s := "can't store data at section \"" + e.section + "\"" - if e.subsection != nil { - s += ", subsection \"" + *e.subsection + "\"" +type extraData struct { + loc +} + +type locErr struct { + msg string + loc +} + +func (l loc) String() string { + s := "section \"" + l.section + "\"" + if l.subsection != nil { + s += ", subsection \"" + *l.subsection + "\"" } - if e.variable != nil { - s += ", variable \"" + *e.variable + "\"" + if l.variable != nil { + s += ", variable \"" + *l.variable + "\"" } return s } +func (e extraData) Error() string { + return "can't store data at " + e.loc.String() +} + +func (e locErr) Error() string { + return e.msg + " at " + e.loc.String() +} + var _ error = extraData{} +var _ error = locErr{} |
