File: errors.go

package info (click to toggle)
golang-github-xenolf-lego 4.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,080 kB
  • sloc: xml: 533; makefile: 128; sh: 18
file content (25 lines) | stat: -rw-r--r-- 527 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package resolver

import (
	"bytes"
	"fmt"
	"sort"
)

// obtainError is returned when there are specific errors available per domain.
type obtainError map[string]error

func (e obtainError) Error() string {
	buffer := bytes.NewBufferString("error: one or more domains had a problem:\n")

	var domains []string
	for domain := range e {
		domains = append(domains, domain)
	}
	sort.Strings(domains)

	for _, domain := range domains {
		buffer.WriteString(fmt.Sprintf("[%s] %s\n", domain, e[domain]))
	}
	return buffer.String()
}