Skip to content

Commit

Permalink
Don't panic on unknown error
Browse files Browse the repository at this point in the history
Currently driver panics on unknown error.
It is better to return generic error with maximum available information
in it.
  • Loading branch information
dkropachev committed Dec 20, 2024
1 parent a5b05d0 commit 78f1fc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ type RequestErrCASWriteUnknown struct {
BlockFor int
}

type UnknownServerError struct {
errorFrame
}

type OpType uint8

const (
Expand Down
4 changes: 3 additions & 1 deletion frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
}
Expand Down

0 comments on commit 78f1fc4

Please sign in to comment.