-
Notifications
You must be signed in to change notification settings - Fork 8
/
errors.go
33 lines (28 loc) · 1.06 KB
/
errors.go
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
28
29
30
31
32
33
package goldi
import "fmt"
// A TypeReferenceError occurs if you tried to inject a type that does not match the function declaration of the corresponding method.
type TypeReferenceError struct {
error
TypeID string
TypeInstance interface{}
}
// The UnknownTypeReferenceError occurs if you try to get a type by an unknown type id (type has not been registered).
type UnknownTypeReferenceError struct {
error
TypeID string
}
// newTypeReferenceError creates a new TypeReferenceError
func newTypeReferenceError(typeID string, typeInstance interface{}, message string, printfParameters ...interface{}) TypeReferenceError {
return TypeReferenceError{
error: fmt.Errorf(message, printfParameters...),
TypeID: typeID,
TypeInstance: typeInstance,
}
}
// newUnknownTypeReferenceError creates a new UnknownTypeReferenceError
func newUnknownTypeReferenceError(typeID, message string, printfParameters ...interface{}) UnknownTypeReferenceError {
return UnknownTypeReferenceError{
error: fmt.Errorf(message, printfParameters...),
TypeID: typeID,
}
}