tui: Error handling tweak
Moved errors to bottom of screen, fix infinite loop by typing errors properly
This commit is contained in:
@@ -32,7 +32,7 @@ type (
|
||||
// sent to a state when it is entered
|
||||
MsgViewEnter struct{}
|
||||
// sent when a recoverable error occurs (displayed to user)
|
||||
MsgError error
|
||||
MsgError struct { Err error }
|
||||
// sent when the view has handled a key input
|
||||
MsgKeyHandled tea.KeyMsg
|
||||
)
|
||||
@@ -57,6 +57,10 @@ func KeyHandled(key tea.KeyMsg) tea.Cmd {
|
||||
|
||||
func WrapError(err error) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
return MsgError(err)
|
||||
return MsgError{ Err: err }
|
||||
}
|
||||
}
|
||||
|
||||
func AsMsgError(err error) MsgError {
|
||||
return MsgError{ Err: err }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user