Created
February 12, 2015 18:04
-
-
Save afex/9e8c6516e6efa6e9d7fd to your computer and use it in GitHub Desktop.
example hystrix-go panic
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 main | |
import ( | |
"log" | |
"github.com/afex/hystrix-go/hystrix" | |
) | |
func main() { | |
result := make(chan int) | |
errors := hystrix.Go("", func() error { | |
panic("ahhhhhh") // comment this panic to see normal behavior | |
result <- 1 | |
return nil | |
}, func(err error) error { | |
result <- 2 | |
return nil | |
}) | |
select { | |
case r := <-result: | |
log.Print(r) | |
case err := <-errors: | |
log.Print(err) | |
} | |
log.Print("done") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment