mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
plugin: Use %w to wrap user error (#7489)
This commit is contained in:
@@ -67,7 +67,7 @@ func (f HandlerFunc) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.
|
|||||||
func (f HandlerFunc) Name() string { return "handlerfunc" }
|
func (f HandlerFunc) Name() string { return "handlerfunc" }
|
||||||
|
|
||||||
// Error returns err with 'plugin/name: ' prefixed to it.
|
// Error returns err with 'plugin/name: ' prefixed to it.
|
||||||
func Error(name string, err error) error { return fmt.Errorf("%s/%s: %s", "plugin", name, err) }
|
func Error(name string, err error) error { return fmt.Errorf("%s/%s: %w", "plugin", name, err) }
|
||||||
|
|
||||||
// NextOrFailure calls next.ServeDNS when next is not nil, otherwise it will return, a ServerFailure and a `no next plugin found` error.
|
// NextOrFailure calls next.ServeDNS when next is not nil, otherwise it will return, a ServerFailure and a `no next plugin found` error.
|
||||||
func NextOrFailure(name string, next Handler, ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
|
func NextOrFailure(name string, next Handler, ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user