diff options
author | Francis Lavoie <lavofr@gmail.com> | 2022-03-05 18:34:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-05 16:34:19 -0700 |
commit | d058dee11d7cfcf0b711f0378d10c9e5cabc8982 (patch) | |
tree | 67cc4e1ddade57986340531497e7d45d82f82f43 /caddyconfig | |
parent | 09ba9e994e6391162fbfdfbd90c72270bdff3a49 (diff) |
reverseproxy: Refactor dial address parsing, augment command parsing (#4616)
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) } |