diff --git a/go/vt/vterrors/code.go b/go/vt/vterrors/code.go index 31c98cef280..bb20097e1da 100644 --- a/go/vt/vterrors/code.go +++ b/go/vt/vterrors/code.go @@ -240,8 +240,15 @@ func errorWithoutState(id string, code vtrpcpb.Code, short, long string) func(ar func errorWithState(id string, code vtrpcpb.Code, state State, short, long string) func(args ...any) *VitessError { return func(args ...any) *VitessError { + var err error + if len(args) != 0 { + err = NewErrorf(code, state, id+": "+short, args...) + } else { + err = NewError(code, state, id+": "+short) + } + return &VitessError{ - Err: NewErrorf(code, state, id+": "+short, args...), + Err: err, Description: long, ID: id, State: state,