ErrorString

This commit is contained in:
Sebastian Frank 2021-09-07 18:11:31 +02:00
parent 1e15e2b753
commit b5b0615018
Signed by: apairon
GPG Key ID: A0E05A8199CE3F57

10
main.go

@ -46,9 +46,10 @@ type ActionConfig struct {
OnSuccess []ActionConfig `yaml:"onSuccess"` OnSuccess []ActionConfig `yaml:"onSuccess"`
OnError []ActionConfig `yaml:"onError"` OnError []ActionConfig `yaml:"onError"`
Directory *DirectoryConfig `yaml:"-"` Directory *DirectoryConfig `yaml:"-"`
Parent *ActionConfig `yaml:"-"` Parent *ActionConfig `yaml:"-"`
Error error `yaml:"-"` Error error `yaml:"-"`
ErrorString string `yaml:"-"`
} }
type DirectoryConfig struct { type DirectoryConfig struct {
@ -254,6 +255,9 @@ func runAction(action *ActionConfig, eventInfo notify.EventInfo, ctx actionCtx)
if err != nil { if err != nil {
add2Ctx(action, ctx, "error", err.Error()) add2Ctx(action, ctx, "error", err.Error())
action.Error = err action.Error = err
if err != nil {
action.ErrorString = err.Error()
}
log.Printf("[ ERROR ] path=\"%s\" action=\"%s\" error=\"%s\"", eventInfo.Path(), action.Id, err) log.Printf("[ ERROR ] path=\"%s\" action=\"%s\" error=\"%s\"", eventInfo.Path(), action.Id, err)
for _, aE := range action.OnError { for _, aE := range action.OnError {