Skip to content

Instantly share code, notes, and snippets.

@jrossi
Last active August 29, 2015 14:14
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 jrossi/e5c6f14ca37aa4f66cb5 to your computer and use it in GitHub Desktop.
Save jrossi/e5c6f14ca37aa4f66cb5 to your computer and use it in GitHub Desktop.
error issues
package main
import (
"fmt"
"github.com/coreos/go-etcd/etcd"
"log"
"os"
"reflect"
)
func main() {
conn := etcd.NewClient([]string{"127.0.0.1:4001"})
fmt.Println(conn.GetCluster())
conn.SetCluster(conn.GetCluster())
_, err := conn.Get("/testing/nothinghere", false, false)
if err != nil {
// https://github.com/coreos/go-etcd/blob/master/etcd/error.go#L18
log.Println(reflect.TypeOf(err))
log.Println(err)
//log.Println(err.ErrorCode)
os.Exit(1)
}
}
# go run main2.go
[127.0.0.1:4001]
2015/01/26 12:44:18 *etcd.EtcdError
2015/01/26 12:44:18 100: Key not found (/testing) [66]
exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment