Skip to content

Commit ac22f2e

Browse files
authored
✨ Ensure addon adapter logs stack traces. (#864)
The adapter used to log errors but got removed in some previous patch. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved error handling and logging for addon failures, ensuring errors are now explicitly logged when they occur. * Enhanced error messages in task data processing for better clarity and troubleshooting. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Jeff Ortel <[email protected]>
1 parent 19c17e6 commit ac22f2e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

addon/adapter.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os"
99

1010
logapi "github.com/go-logr/logr"
11+
liberr "github.com/jortel/go-utils/error"
1112
"github.com/jortel/go-utils/logr"
1213
"github.com/konveyor/tackle2-hub/binding"
1314
"github.com/konveyor/tackle2-hub/settings"
@@ -17,6 +18,7 @@ import (
1718

1819
var (
1920
Settings = &settings.Settings
21+
Wrap = liberr.Wrap
2022
Log = logr.WithName("addon")
2123
)
2224

@@ -128,6 +130,7 @@ func (h *Adapter) Run(addon func() error) {
128130
}
129131
if err != nil {
130132
h.Failed(err.Error())
133+
h.Log.Error(err, "Addon failed.")
131134
os.Exit(1)
132135
}
133136
}()

addon/task.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func (h *Task) Data() (d any) {
118118
func (h *Task) DataWith(object any) (err error) {
119119
b, _ := json.Marshal(h.task.Data)
120120
err = json.Unmarshal(b, object)
121+
err = Wrap(err)
121122
return
122123
}
123124

0 commit comments

Comments
 (0)