Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ksakae1216
Created July 2, 2018 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksakae1216/55389539e6654d56183c35eafde4c7ce to your computer and use it in GitHub Desktop.
Save ksakae1216/55389539e6654d56183c35eafde4c7ce to your computer and use it in GitHub Desktop.
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