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:
Ainar Garipov
2021-05-24 17:28:11 +03:00
parent 14250821ab
commit 03a828ef51
60 changed files with 406 additions and 672 deletions

View File

@@ -11,8 +11,8 @@ import (
"sync"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/insomniacslk/dhcp/dhcpv6"
"github.com/insomniacslk/dhcp/dhcpv6/server6"
@@ -165,7 +165,7 @@ func (s *v6Server) rmDynamicLease(lease Lease) error {
// AddStaticLease adds a static lease. It is safe for concurrent use.
func (s *v6Server) AddStaticLease(l Lease) (err error) {
defer agherr.Annotate("dhcpv6: %w", &err)
defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
if len(l.IP) != 16 {
return fmt.Errorf("invalid IP")
@@ -194,7 +194,7 @@ func (s *v6Server) AddStaticLease(l Lease) (err error) {
// RemoveStaticLease removes a static lease. It is safe for concurrent use.
func (s *v6Server) RemoveStaticLease(l Lease) (err error) {
defer agherr.Annotate("dhcpv6: %w", &err)
defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
if len(l.IP) != 16 {
return fmt.Errorf("invalid IP")
@@ -585,7 +585,7 @@ func (s *v6Server) initRA(iface *net.Interface) error {
// Start starts the IPv6 DHCP server.
func (s *v6Server) Start() (err error) {
defer agherr.Annotate("dhcpv6: %w", &err)
defer func() { err = errors.Annotate(err, "dhcpv6: %w") }()
if !s.conf.Enabled {
return nil