Skip to content

Commit 544a3e2

Browse files
committed
ING-784: Include server duration in memdx errors for crud ops
1 parent 241b081 commit 544a3e2

File tree

4 files changed

+324
-254
lines changed

4 files changed

+324
-254
lines changed

memdx/errors.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"strconv"
8+
"time"
89
)
910

1011
var (
@@ -260,3 +261,19 @@ func (e DcpRollbackError) Error() string {
260261
func (e DcpRollbackError) Unwrap() error {
261262
return ErrDcpRollback
262263
}
264+
265+
type ErrorWithServerDuration struct {
266+
Cause error
267+
ServerDuration time.Duration
268+
}
269+
270+
func (e ErrorWithServerDuration) Error() string {
271+
return fmt.Sprintf(
272+
"%s (server duration: %s)",
273+
e.Cause,
274+
e.ServerDuration)
275+
}
276+
277+
func (e ErrorWithServerDuration) Unwrap() error {
278+
return e.Cause
279+
}

memdx/harness_int_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func dialAndBootstrapClient(t *testing.T, addr, user, pass, bucket string) (*mem
6969
memdx.HelloFeatureSyncReplication,
7070
memdx.HelloFeatureSnappy,
7171
memdx.HelloFeatureSnappyEverywhere,
72+
memdx.HelloFeatureDurations,
7273
},
7374
},
7475
GetErrorMap: &memdx.GetErrorMapRequest{

0 commit comments

Comments
 (0)