add error pkg

This commit is contained in:
Livio Amstutz
2020-03-18 15:45:24 +01:00
parent f8fdbb0611
commit 238347ddfb
30 changed files with 978 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package errors
import (
"strings"
)
// Error is a stdlib error extension.
// It contains parameters to identify errors through all application layers
type Error interface {
GetParent() error
GetMessage() string
GetID() string
}
// Contains compares the error message with needle
func Contains(err error, needle string) bool {
return err != nil && strings.Contains(err.Error(), needle)
}