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
View File

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