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.
This commit is contained in:
Miek Gieben
2016-12-20 18:58:05 +00:00
committed by GitHub
parent 451a0bd529
commit c4ab98c6e3
23 changed files with 51 additions and 67 deletions

View File

@@ -8,7 +8,7 @@ import (
"github.com/miekg/dns"
)
// PorseHostPortOrFile parses the strings in s, each string can either be a address,
// ParseHostPortOrFile parses the strings in s, each string can either be a address,
// address:port or a filename. The address part is checked and the filename case a
// resolv.conf like file is parsed and the nameserver found are returned.
func ParseHostPortOrFile(s ...string) ([]string, error) {