Skip to content

Commit 1bfb146

Browse files
authored
fix: wrap full validation errors instead of just their message (#232)
This PR contains a simple adjustment to the error handling of the struct field validation. Previously only the string representation of the error was included in the returned `SDKError`, but an upcoming change to the CLI plugins requires the actual error object, because it contains valuable information. Signed-off-by: Norbert Biczo <[email protected]>
1 parent 8da480a commit 1bfb146

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func ValidateStruct(param interface{}, paramName string) error {
7979
if err != nil {
8080
// If there were validation errors then return an error containing the field errors
8181
if fieldErrors, ok := err.(validator.ValidationErrors); ok {
82-
err = fmt.Errorf("%s failed validation:\n%s", paramName, fieldErrors.Error())
82+
err = fmt.Errorf("%s failed validation:\n%w", paramName, fieldErrors)
8383
return SDKErrorf(err, "", "struct-validation-errors", getComponentInfo())
8484
}
8585
return SDKErrorf(err, "", "struct-validate-unknown-error", getComponentInfo())

0 commit comments

Comments
 (0)