From 3682a36fde3d59bb8d9a900ba32da02ed9f13acb Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Mon, 30 Sep 2024 00:48:27 -0400 Subject: [PATCH] feat: decode conf error msg --- internal/stage/util.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/stage/util.go b/internal/stage/util.go index 4c9f084..a061a1e 100644 --- a/internal/stage/util.go +++ b/internal/stage/util.go @@ -1,12 +1,16 @@ package stage -import "github.com/mitchellh/mapstructure" +import ( + "fmt" + + "github.com/mitchellh/mapstructure" +) func DecodeConf[T any](confAny any) (*T, error) { var conf T err := mapstructure.Decode(confAny, &conf) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to decode conf: %w", err) } return &conf, nil }