aboutsummaryrefslogtreecommitdiff
path: root/errs/type.go
blob: f726e89b07cc9bab4469f0f50a6bcf86118aa953 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package errs

import (
	"fmt"

	"lindenii.org/go/furgit/object/id"
	"lindenii.org/go/furgit/object/typ"
)

// ObjectTypeError indicates that a referenced object
// has a different type than what the operation expected.
type ObjectTypeError struct {
	OID  id.ObjectID
	Got  typ.Type
	Want typ.Type
}

// Error implements error.
func (e *ObjectTypeError) Error() string {
	return fmt.Sprintf(
		"object %s has type %s, want %s",
		e.OID, e.Got.Name(), e.Want.Name(),
	)
}