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
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 6 additions and 0 deletions

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{}