In this case, because you call the same function, you could also try a
helper function:
// GetParameters retrieves multiple parameters using GetParameter.
func GetParameters(params ...string) ([]string, error) {
var values []string
for _, param := range params {
value, err := GetParameter(param)
Indeed I learned this from https://blog.golang.org/defer-panic-and-recover
and they mention this is done in the json module. And I couldn't adhere
more. It's basically the same as try-catch from other languages.
Doing this systematically in a Rest server for errors of type 502, 400, 404
(in t
This looks like something I might have done. However, my preference would
be to write a wrapper MustGetParameter receives string field, calls
store.GetParameter(field), returns parameter or panics.
You may then use
defer func() { globalErr = recover()}
tenantID, err1 := MustGetParamete