aboutsummaryrefslogtreecommitdiffhomepage
path: root/ldd/error.go
blob: 39b63ef9bb59efeffaea0ce6eb72fa78233ac2f9 (plain)
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
26
27
package ldd

import (
	"errors"
	"fmt"
)

var (
	ErrUnexpectedSeparator = errors.New("unexpected separator")
	ErrPathNotAbsolute     = errors.New("path not absolute")
	ErrBadLocationFormat   = errors.New("bad location format")
	ErrUnexpectedNewline   = errors.New("unexpected newline")
)

type EntryUnexpectedSegmentsError string

func (e EntryUnexpectedSegmentsError) Is(err error) bool {
	var eq EntryUnexpectedSegmentsError
	if !errors.As(err, &eq) {
		return false
	}
	return e == eq
}

func (e EntryUnexpectedSegmentsError) Error() string {
	return fmt.Sprintf("unexpected segments in entry %q", string(e))
}