summaryrefslogtreecommitdiff
path: root/caddyconfig/caddyfile
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-03-05 18:34:19 -0500
committerGitHub <noreply@github.com>2022-03-05 16:34:19 -0700
commitd058dee11d7cfcf0b711f0378d10c9e5cabc8982 (patch)
tree67cc4e1ddade57986340531497e7d45d82f82f43 /caddyconfig/caddyfile
parent09ba9e994e6391162fbfdfbd90c72270bdff3a49 (diff)
reverseproxy: Refactor dial address parsing, augment command parsing (#4616)
Diffstat (limited to 'caddyconfig/caddyfile')
-rwxr-xr-xcaddyconfig/caddyfile/dispenser.go6
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)
}