Created
July 2, 2018 12:43
-
-
Save ksakae1216/55389539e6654d56183c35eafde4c7ce 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 funcpkg | |
import ( | |
"fmt" | |
) | |
// RecoveryFunc recoveryのサンプルです | |
func RecoveryFunc() { | |
defer func() { | |
err := recover() | |
if err != nil { | |
fmt.Println("パニックが発生してるのでここでリカバリー") | |
} | |
}() | |
fmt.Println("処理 start") | |
panic("パニック発生!!") | |
fmt.Println("処理 end") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment