-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patherrors.go
More file actions
53 lines (39 loc) · 2.22 KB
/
errors.go
File metadata and controls
53 lines (39 loc) · 2.22 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package pal
import (
"errors"
)
// Error variables used throughout the package
var (
// ErrServiceNotFound is returned when a requested service is not found in the container.
// This typically happens when trying to Invoke a service that hasn't been registered.
ErrServiceNotFound = errors.New("service not found")
// ErrMultipleServicesFoundByInterface is returned when multiple services are found in the container by interface.
ErrMultipleServicesFoundByInterface = errors.New("multiple services found by interface")
// ErrServiceInitFailed is returned when a service fails to initialize.
// This can happen during container initialization if a service's Init method returns an error.
ErrServiceInitFailed = errors.New("service initialization failed")
// ErrServiceInvalid is returned when a service is invalid.
// This can happen when a service doesn't implement a required interface or when type assertions fail.
ErrServiceInvalid = errors.New("service invalid")
// ErrServiceInvalidArgumentsCount is returned when a service is called with incorrect number of arguments.
ErrServiceInvalidArgumentsCount = errors.New("service called with incorrect number of arguments")
// ErrServiceInvalidArgumentType is returned when a service is called with incorrect argument type.
ErrServiceInvalidArgumentType = errors.New("service called with incorrect argument type")
// ErrFactoryServiceDependency is returned when a service with a factory service dependency is invoked.
ErrFactoryServiceDependency = errors.New("factory service cannot be a dependency of another service")
// ErrServiceInvalidCast is returned when a service is cast to a different type.
ErrServiceInvalidCast = errors.New("failed to cast service to the expected type")
// ErrInvokerIsNotInContext is returned when a context passed to Invoke does not contain a Pal instance.
ErrInvokerIsNotInContext = errors.New("invoker is not in context")
// ErrInvalidTag is returned when a tag is invalid.
ErrInvalidTag = errors.New("invalid tag")
// ErrNotAnInterface is returned when a type is not an interface.
ErrNotAnInterface = errors.New("not an interface")
)
type PanicError struct {
error
backtrace string
}
func (e *PanicError) Backtrace() string {
return e.backtrace
}