Debian Codegraph @

tq/errors.go

raw symbols SCIP
1 package tq
2
3 import "github.com/git-lfs/git-lfs/v3/tr"
4
5 type MalformedObjectError struct {
6 Name string
7 Oid string
8
9 missing bool
10 }
11
12 func newObjectMissingError(name, oid string) error {
13 return &MalformedObjectError{Name: name, Oid: oid, missing: true}
14 }
15
16 func newCorruptObjectError(name, oid string) error {
17 return &MalformedObjectError{Name: name, Oid: oid, missing: false}
18 }
19
20 func (e MalformedObjectError) Missing() bool { return e.missing }
21
22 func (e MalformedObjectError) Corrupt() bool { return !e.Missing() }
23
24 func (e MalformedObjectError) Error() string {
25 if e.Corrupt() {
26 return tr.Tr.Get("corrupt object: %s (%s)", e.Name, e.Oid)
27 }
28 return tr.Tr.Get("missing object: %s (%s)", e.Name, e.Oid)
29 }