Last active
October 4, 2020 22:36
-
-
Save martinsson/fc43ff769a2b7856aac6b103f635fab0 to your computer and use it in GitHub Desktop.
Error handling in GO 2/3 : A better version of the error handling. No more if statement per variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tenantID, err1 := store.GetParameter("TENANT_ID") | |
clientID, err2 := store.GetParameter("CLIENT_ID") | |
clientSecret, err3 := store.GetParameter("CLIENT_SECRET") | |
globalErr := multierr.Combine(err1, err2, err3) | |
if globalErr != nil { | |
fmt.Print(globalErr) | |
return nil, globalErr | |
} | |
return connection{ | |
tenantID, | |
clientID, | |
clientSecret, | |
}, nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment