-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
35 lines (29 loc) · 1.2 KB
/
errors.go
File metadata and controls
35 lines (29 loc) · 1.2 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
// GNU GPL v3 License
// Copyright (c) 2017 github.com/ymhhh
package classloader
import (
"errors"
"fmt"
"reflect"
)
// ErrorType is the reflect.Type of the built-in error interface.
// Used to validate Construct method signatures.
var ErrorType = reflect.TypeOf((*error)(nil)).Elem()
// Class loader errors.
var (
ErrNilClassValue = errors.New("class value must not be nil")
ErrInvalidClassType = errors.New("unsupported class type: expected pointer, array, chan, map, or slice")
)
// ReflectiveDynamicAccess errors.
var (
ErrFailedCreateInstance = errors.New("failed create instance")
ErrNotFoundConstructMethod = errors.New("not found construct method")
ErrBadActorInitFuncOutNumber = errors.New("the actor init function, result should error or nothing")
ErrNotFoundInClassLoader = errors.New("class not found in class loader")
ErrBadConstructArgCount = errors.New("construct method argument count mismatch")
ErrBadConstructArgType = errors.New("construct method argument type mismatch")
)
// NotFoundInClassLoader returns an error indicating the named class was not loaded.
func NotFoundInClassLoader(name string) error {
return fmt.Errorf("%w: %s", ErrNotFoundInClassLoader, name)
}