Skip to content

Commit

Permalink
better err msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
buglloc committed Jan 19, 2024
1 parent 60151b5 commit 872e55b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/config/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (l *RFC2136Listener) Validate() error {
func (r *Runtime) NewListener() (listener.Listener, error) {
u, err := r.NewUpstream()
if err != nil {
return nil, fmt.Errorf("unable to create upstream for listener: %w", err)
return nil, fmt.Errorf("create upstream for listener: %w", err)
}

switch r.cfg.Listener.Kind {
Expand Down
4 changes: 2 additions & 2 deletions internal/listener/lrfc2136/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (a *Listener) handleQuery(ctx context.Context, m *dns.Msg, r *dns.Msg) erro
if soa.Hdr.Name != q.Name {
return dnserr.NewDNSError(
dns.RcodeServerFailure,
fmt.Errorf("%q is not a zone", q.Name),
fmt.Errorf("%q (question) is not a zone %q (header)", q.Name, soa.Hdr.Name),
)
}

Expand All @@ -281,7 +281,7 @@ func (a *Listener) handleQuery(ctx context.Context, m *dns.Msg, r *dns.Msg) erro
if len(rules) == 0 {
return dnserr.NewDNSError(
dns.RcodeNameError,
fmt.Errorf("no reqords for %q was found", q.Name),
fmt.Errorf("no records for %q was found", q.Name),
)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/upstream/uadguard/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (t *Tx) Append(r upstream.Rule) error {

arpa, err := dns.ReverseAddr(r.ValueStr)
if err != nil {
return fmt.Errorf("unable to generate arpa address: %w", err)
return fmt.Errorf("generate arpa address: %w", err)
}

_ = t.rules.Delete(upstream.Rule{
Expand Down
2 changes: 1 addition & 1 deletion internal/upstream/ucloudflare/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewUpstream(token string, opts ...Option) (*Upstream, error) {
httpc := xhttp.NewHTTPClient()
cfc, err := cloudflare.NewWithAPIToken(token, cloudflare.HTTPClient(httpc))
if err != nil {
return nil, fmt.Errorf("unable to create cloudflare client: %w", err)
return nil, fmt.Errorf("create cloudflare client: %w", err)
}

return NewUpstreamWithCFC(cfc, opts...)
Expand Down

0 comments on commit 872e55b

Please sign in to comment.