08774bf091
Remove the Verb method on the Direction object in favor of a method formatting the operation in progress. This is easier to translate and will prevent sentence fragments from appearing in strings. Additionally, move a variable down into a function so that we can translate it, since strings at the top level cannot be translated due to the locale object not being initialized yet.
30 lines
709 B
Go
30 lines
709 B
Go
package tq
|
|
|
|
import "github.com/git-lfs/git-lfs/v3/tr"
|
|
|
|
type MalformedObjectError struct {
|
|
Name string
|
|
Oid string
|
|
|
|
missing bool
|
|
}
|
|
|
|
func newObjectMissingError(name, oid string) error {
|
|
return &MalformedObjectError{Name: name, Oid: oid, missing: true}
|
|
}
|
|
|
|
func newCorruptObjectError(name, oid string) error {
|
|
return &MalformedObjectError{Name: name, Oid: oid, missing: false}
|
|
}
|
|
|
|
func (e MalformedObjectError) Missing() bool { return e.missing }
|
|
|
|
func (e MalformedObjectError) Corrupt() bool { return !e.Missing() }
|
|
|
|
func (e MalformedObjectError) Error() string {
|
|
if e.Corrupt() {
|
|
return tr.Tr.Get("corrupt object: %s (%s)", e.Name, e.Oid)
|
|
}
|
|
return tr.Tr.Get("missing object: %s (%s)", e.Name, e.Oid)
|
|
}
|