diff options
Diffstat (limited to 'caddyconfig')
-rwxr-xr-x | caddyconfig/caddyfile/dispenser.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/caddyconfig/caddyfile/dispenser.go b/caddyconfig/caddyfile/dispenser.go index fa7f5e7..23f6ead 100755 --- a/caddyconfig/caddyfile/dispenser.go +++ b/caddyconfig/caddyfile/dispenser.go @@ -350,7 +350,11 @@ func (d *Dispenser) Err(msg string) error { // Errf is like Err, but for formatted error messages func (d *Dispenser) Errf(format string, args ...interface{}) error { - err := fmt.Errorf(format, args...) + return d.WrapErr(fmt.Errorf(format, args...)) +} + +// WrapErr takes an existing error and adds the Caddyfile file and line number. +func (d *Dispenser) WrapErr(err error) error { return fmt.Errorf("%s:%d - Error during parsing: %w", d.File(), d.Line(), err) } |