Exemple #1
0
// protectedRawWatch wraps watch in a panic recovery to work around https://github.com/coreos/go-etcd/pull/212
func protectedRawWatch(client *etcd.Client, path string, index uint64, recursive bool, receiver chan *etcd.RawResponse, stop chan bool) (resp *etcd.RawResponse, err error) {
	defer func() {
		if rerr := recover(); rerr != nil {
			perr, ok := rerr.(error)
			if ok {
				err = &panicerror{perr}
			} else {
				err = fmt.Errorf("unknown recover error: %v", rerr)
			}
		}
	}()

	return client.RawWatch(path, index, recursive, receiver, stop)
}