Initial import
This commit is contained in:
26
error.go
Normal file
26
error.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package dpi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInvalid = errors.New("invalid")
|
||||
)
|
||||
|
||||
type DecodeError struct {
|
||||
Reason string
|
||||
Err error
|
||||
}
|
||||
|
||||
func (err DecodeError) Error() string {
|
||||
if err.Reason != "" {
|
||||
return fmt.Sprintf("dpi: %s: %v", err.Reason, err.Err.Error())
|
||||
}
|
||||
return err.Error()
|
||||
}
|
||||
|
||||
func (err DecodeError) Unwrap() error {
|
||||
return err.Err
|
||||
}
|
Reference in New Issue
Block a user