aboutsummaryrefslogtreecommitdiff
path: root/middleware/backend_lookup.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-12-20 18:58:05 +0000
committerGravatar GitHub <noreply@github.com> 2016-12-20 18:58:05 +0000
commitc4ab98c6e336a1c39b3934bbb3bf691f849a6dbe (patch)
tree89d801ac1484232179bcb7c144f67b5945221367 /middleware/backend_lookup.go
parent451a0bd5294f6c8a6c9c725c75ac1a9cbc996a42 (diff)
downloadcoredns-c4ab98c6e336a1c39b3934bbb3bf691f849a6dbe.tar.gz
coredns-c4ab98c6e336a1c39b3934bbb3bf691f849a6dbe.tar.zst
coredns-c4ab98c6e336a1c39b3934bbb3bf691f849a6dbe.zip
Add middleware.NextOrFailure (#462)
This checks if the next middleware to be called is nil, and if so returns ServerFailure and an error. This makes the next calling more robust and saves some lines of code. Also prefix the error with the name of the middleware to aid in debugging.
Diffstat (limited to 'middleware/backend_lookup.go')
-rw-r--r--middleware/backend_lookup.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/middleware/backend_lookup.go b/middleware/backend_lookup.go
index c52bb2881..b9de97d67 100644
--- a/middleware/backend_lookup.go
+++ b/middleware/backend_lookup.go
@@ -410,7 +410,7 @@ func BackendError(b ServiceBackend, zone string, rcode int, state request.Reques
state.SizeAndDo(m)
state.W.WriteMsg(m)
// Return success as the rcode to signal we have written to the client.
- return dns.RcodeSuccess, nil
+ return dns.RcodeSuccess, err
}
// ServicesToTxt puts debug in TXT RRs.