Skip to content

Commit

Permalink
Merge pull request #377 from scylladb/dk/dont-panic-on-unknown-errror
Browse files Browse the repository at this point in the history
Don't panic on unknown error
  • Loading branch information
dkropachev authored Dec 20, 2024
2 parents e12494d + eb9141c commit 3785839
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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 @@ -729,7 +729,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
2 changes: 0 additions & 2 deletions frame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ func TestFuzzBugs(t *testing.T) {
"0000000"),
[]byte("\x82\xe600\x00\x00\x00\x000"),
[]byte("\x8200\b\x00\x00\x00\b0\x00\x00\x00\x040000"),
[]byte("\x8200\x00\x00\x00\x00\x100\x00\x00\x12\x00\x00\x0000000" +
"00000"),
[]byte("\x83000\b\x00\x00\x00\x14\x00\x00\x00\x020000000" +
"000000000"),
[]byte("\x83000\b\x00\x00\x000\x00\x00\x00\x04\x00\x1000000" +
Expand Down

0 comments on commit 3785839

Please sign in to comment.