mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-20 22:11:50 +03:00
05262d7b6b
Squashed commit of the following: commit 7a24cf8f9c5515f642cbfc7e730b95005eeab11d Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Aug 15 14:54:16 2023 +0300 all: upd code, deps, tools
24 lines
645 B
Go
24 lines
645 B
Go
//go:build darwin || freebsd || linux || openbsd
|
|
|
|
package dhcpd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/AdguardTeam/golibs/errors"
|
|
)
|
|
|
|
// wrapErrs is a helper to wrap the errors from two independent underlying
|
|
// connections.
|
|
func wrapErrs(action string, udpConnErr, rawConnErr error) (err error) {
|
|
switch {
|
|
case udpConnErr != nil && rawConnErr != nil:
|
|
return fmt.Errorf("%s both connections: %s", action, errors.Join(udpConnErr, rawConnErr))
|
|
case udpConnErr != nil:
|
|
return fmt.Errorf("%s udp connection: %w", action, udpConnErr)
|
|
case rawConnErr != nil:
|
|
return fmt.Errorf("%s raw connection: %w", action, rawConnErr)
|
|
default:
|
|
return nil
|
|
}
|
|
}
|