Created
September 6, 2015 15:26
-
-
Save kaneshin/41e3db1af0a393acacbd to your computer and use it in GitHub Desktop.
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
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