Skip to content

Commit 0cb4b7a

Browse files
committed
Improve SurveyAskOne stub error messages
1 parent 90ec108 commit 0cb4b7a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/prompt/stubber.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ func InitAskStubber() (*AskStubber, func()) {
9898
}
9999

100100
if err := core.WriteAnswer(response, fieldName, userValue); err != nil {
101-
return fmt.Errorf("AskStubber failed writing the answer for field %q: %w", fieldName, err)
101+
topic := fmt.Sprintf("field %q", fieldName)
102+
if fieldName == "" {
103+
topic = fmt.Sprintf("%q", message)
104+
}
105+
return fmt.Errorf("AskStubber failed writing the answer for %s: %w", topic, err)
102106
}
103107
return nil
104108
}

0 commit comments

Comments
 (0)