#Zenith errors in Go

1 messages · Page 1 of 1 (latest)

runic seal
#

Hey! đŸ‘‹ In the constructor, as with any function, you just return the error. See Step 2: Add a function in the Go Quickstart, particularly the second code snippet in the first step:

func (m *Potato) HelloWorld() string
func (m *Potato) HelloWorld() (string, error)
func (m *Potato) HelloWorld(ctx context.Context) string
func (m *Potato) HelloWorld(ctx context.Context) (string, error)

Go recognizes if the function returns an error or not and handles appropriately.

pine bough
#

Oh, that's more than clear. Thanks so much!
I'd assume then from the zenith module that's calling another that's returning an error —assuming that it was thrown and properly returned—, the caller module should handle it properly in the normal Go way. Is my assumption correct?

south copper