You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
430 B
32 lines
430 B
package variable
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
)
|
|
|
|
type Error struct {
|
|
Name string
|
|
Err error
|
|
Type ArgType
|
|
}
|
|
|
|
func (o Error) Error() string {
|
|
return fmt.Sprintf("%s: '%s' %s", o.Type, o.Name, o.Err)
|
|
}
|
|
|
|
func (o Error) Is(err error) bool {
|
|
return errors.Is(err, o.Err)
|
|
}
|
|
|
|
func (o Error) Unwrap() error {
|
|
return o.Err
|
|
}
|
|
|
|
func Err(name string, t ArgType, err error) Error {
|
|
return Error{
|
|
Name: name,
|
|
Type: t,
|
|
Err: err,
|
|
}
|
|
}
|
|
|