Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
Merge 7f5a770 into 758ce21
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel committed Aug 1, 2019
2 parents 758ce21 + 7f5a770 commit 511b3c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
@@ -1,7 +1,6 @@
language: go
go:
- 1.11
- 1.9
- "1.x"
- tip

go_import_path: github.com/samuel/go-zookeeper
Expand Down
5 changes: 3 additions & 2 deletions zk/structs.go
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"reflect"
"runtime"
"strings"
"time"
)

Expand Down Expand Up @@ -404,7 +405,7 @@ type encoder interface {
func decodePacket(buf []byte, st interface{}) (n int, err error) {
defer func() {
if r := recover(); r != nil {
if e, ok := r.(runtime.Error); ok && e.Error() == "runtime error: slice bounds out of range" {
if e, ok := r.(runtime.Error); ok && strings.HasPrefix(e.Error(), "runtime error: slice bounds out of range") {
err = ErrShortBuffer
} else {
panic(r)
Expand Down Expand Up @@ -495,7 +496,7 @@ func decodePacketValue(buf []byte, v reflect.Value) (int, error) {
func encodePacket(buf []byte, st interface{}) (n int, err error) {
defer func() {
if r := recover(); r != nil {
if e, ok := r.(runtime.Error); ok && e.Error() == "runtime error: slice bounds out of range" {
if e, ok := r.(runtime.Error); ok && strings.HasPrefix(e.Error(), "runtime error: slice bounds out of range") {
err = ErrShortBuffer
} else {
panic(r)
Expand Down

0 comments on commit 511b3c8

Please sign in to comment.