convenience function for creating an ErrMsg from an error

This commit is contained in:
Christian Rocha
2020-01-20 10:54:58 -08:00
parent e1d4a14345
commit 524cf2cffd

6
tea.go
View File

@@ -59,6 +59,12 @@ func NewErrMsg(s string) ErrMsg {
return ErrMsg{errors.New(s)}
}
// NewErrMsgFromErr is a convenience function for creating an ErrMsg from an
// existing error
func NewErrMsgFromErr(e error) ErrMsg {
return ErrMsg{e}
}
// Quit is a command that tells the program to exit
func Quit(_ Model) Msg {
return quitMsg{}