Skip to content

Instantly share code, notes, and snippets.

@kaneshin
Created September 6, 2015 15:26
Show Gist options
  • Save kaneshin/41e3db1af0a393acacbd to your computer and use it in GitHub Desktop.
Save kaneshin/41e3db1af0a393acacbd to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/kaneshin/gopack/exception"
)
// main ...
func main() {
fmt.Println("Hello world")
exception.Try(func() {
fmt.Println("There is no problem.")
}).Catch(func(e exception.Exception) {
fmt.Println("Catch exception.")
}).Finally(func() {
fmt.Println("Do finally.")
})
exception.Try(func() {
fmt.Println("There is a problem.")
panic("Panic happens.")
}).Catch(func(e exception.Exception) {
fmt.Println("Catch exception.")
}).Finally(func() {
fmt.Println("Do finally.")
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment