From 78f1fc468e5332a9caf0c2080396b6c2b5bdf7f5 Mon Sep 17 00:00:00 2001 From: Dmitry Kropachev Date: Fri, 20 Dec 2024 09:29:46 -0400 Subject: [PATCH] Don't panic on unknown error Currently driver panics on unknown error. It is better to return generic error with maximum available information in it. --- errors.go | 4 ++++ frame.go | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/errors.go b/errors.go index 4fb372683..bafaab6ff 100644 --- a/errors.go +++ b/errors.go @@ -197,6 +197,10 @@ type RequestErrCASWriteUnknown struct { BlockFor int } +type UnknownServerError struct { + errorFrame +} + type OpType uint8 const ( diff --git a/frame.go b/frame.go index d7e6b8dc4..8d82d4b4f 100644 --- a/frame.go +++ b/frame.go @@ -723,7 +723,9 @@ func (f *framer) parseErrorFrame() frame { res.RejectedByCoordinator = f.readByte() != 0 return res } else { - panic(fmt.Errorf("unknown error code: 0x%x", errD.code)) + return &UnknownServerError{ + errorFrame: errD, + } } } }