|
@@ -205,6 +205,22 @@ func ParseConsistency(s string) Consistency {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// ParseConsistencyWrapper wraps gocql.ParseConsistency to provide an err
|
|
|
|
|
+// return instead of a panic
|
|
|
|
|
+func ParseConsistencyWrapper(s string) (consistency Consistency, err error) {
|
|
|
|
|
+ defer func() {
|
|
|
|
|
+ if r := recover(); r != nil {
|
|
|
|
|
+ var ok bool
|
|
|
|
|
+ err, ok = r.(error)
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ err = fmt.Errorf("ParseConsistencyWrapper: %v", r)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }()
|
|
|
|
|
+ consistency = ParseConsistency(s)
|
|
|
|
|
+ return consistency, nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
type SerialConsistency uint16
|
|
type SerialConsistency uint16
|
|
|
|
|
|
|
|
const (
|
|
const (
|