Created
April 9, 2017 09:56
-
-
Save bjorand/91caee7ff5f1a3a58419f35bda48cf02 to your computer and use it in GitHub Desktop.
Golang catch panic
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
for { | |
func() { | |
defer func() { | |
if r := recover(); r != nil { | |
fmt.Printf("panic: %v\n", r) | |
} | |
}() | |
// CODE here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment