aboutsummaryrefslogtreecommitdiffhomepage
path: root/ldd/error.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-10-09 23:51:15 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-10-09 23:51:15 +0900
commitd41b9d2d9ceb60ceb601af991441e70929801c42 (patch)
treeec5b9e35e650f6bec9fd9e603301f0d87b7ede76 /ldd/error.go
parent22dfa73efe8a7a15b8867404e6504041a7139406 (diff)
ldd: separate Parse from Exec and trim space
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'ldd/error.go')
-rw-r--r--ldd/error.go26
1 files changed, 21 insertions, 5 deletions
diff --git a/ldd/error.go b/ldd/error.go
index 51aef948..39b63ef9 100644
--- a/ldd/error.go
+++ b/ldd/error.go
@@ -1,11 +1,27 @@
package ldd
-import "fmt"
+import (
+ "errors"
+ "fmt"
+)
-type EntryUnexpectedSegmentsError struct {
- Entry string
+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", e.Entry)
+func (e EntryUnexpectedSegmentsError) Error() string {
+ return fmt.Sprintf("unexpected segments in entry %q", string(e))
}