Pull request: replace agherr with golibs' errors
Merge in DNS/adguard-home from golibs-errors to master Squashed commit of the following: commit 5aba278a31c5a213bd9e08273ce7277c57713b22 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 17:05:18 2021 +0300 all: imp code commit f447eb875b81779fa9e391d98c31c1eeba7ef323 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon May 24 15:33:45 2021 +0300 replace agherr with golibs' errors
This commit is contained in:
@@ -6,8 +6,8 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/filtering"
|
||||
"github.com/AdguardTeam/golibs/errors"
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
@@ -78,13 +78,13 @@ type AddParams struct {
|
||||
func (p *AddParams) validate() (err error) {
|
||||
switch {
|
||||
case p.Question == nil:
|
||||
return agherr.Error("question is nil")
|
||||
return errors.Error("question is nil")
|
||||
case len(p.Question.Question) != 1:
|
||||
return agherr.Error("more than one question")
|
||||
return errors.Error("more than one question")
|
||||
case len(p.Question.Question[0].Name) == 0:
|
||||
return agherr.Error("no host in question")
|
||||
return errors.Error("no host in question")
|
||||
case p.ClientIP == nil:
|
||||
return agherr.Error("no client ip")
|
||||
return errors.Error("no client ip")
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user