-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Show error along with message and quit if applicable #87
Conversation
This pull request has been linked to Shortcut Story #238061: show error response when creating flag in setup wizard. |
@@ -49,13 +50,20 @@ func (m ContainerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |||
case key.Matches(msg, keys.Enter): | |||
switch m.currentStep { | |||
case createFlagStep: | |||
updated, _ := m.steps[createFlagStep].Update(msg) | |||
updated, cmd := m.steps[createFlagStep].Update(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delegates the tea.Quit command. Seems cleaner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels like we should leverage that functionality as much as possible!
@@ -69,6 +72,18 @@ func (m createFlagModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |||
) | |||
if err != nil { | |||
m.err = err | |||
// TODO: we may want a more robust error type so we don't need to do this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we add more steps I'll refactor this.
@@ -49,13 +50,20 @@ func (m ContainerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |||
case key.Matches(msg, keys.Enter): | |||
switch m.currentStep { | |||
case createFlagStep: | |||
updated, _ := m.steps[createFlagStep].Update(msg) | |||
updated, cmd := m.steps[createFlagStep].Update(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels like we should leverage that functionality as much as possible!
Show a "helpful" error message if the response is such that the user couldn't continue the setup flow.
This will print out eg.,