Created
July 29, 2022 08:50
-
-
Save PeteGabriel/75bb4b28488b254ee0acabe4bb7278e0 to your computer and use it in GitHub Desktop.
This file contains 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
package main | |
import ( | |
"errors" | |
"fmt" | |
) | |
func main() { | |
var err error | |
defer func() { | |
if err != nil { | |
fmt.Printf("error found: %v", err) | |
} | |
}() | |
err = throwError() | |
// imagine having more cases where an error can be thrown. | |
} | |
func throwError() error { | |
return errors.New("New Error") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment