Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't panic on unknown error #377

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading