From 524cf2cffd8164b63df92c48b6a58d9da5c00b17 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Mon, 20 Jan 2020 10:54:58 -0800 Subject: [PATCH] convenience function for creating an ErrMsg from an error --- tea.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tea.go b/tea.go index aa824d3..74958dd 100644 --- a/tea.go +++ b/tea.go @@ -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{}