-
Notifications
You must be signed in to change notification settings - Fork 173
Start removing GetErrMsg == "xx" tests #3172
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
Start removing GetErrMsg == "xx" tests #3172
Conversation
Those checks are dangerous since a refactor could easily break them. Using xerrors.Is instead is safer against refactors. Contributes scionproto#3042
a2466e8
to
53b63bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 18 of 18 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @lukedirtwalker)
go/border/rpkt/l4.go, line 28 at r1 (raw file):
If no context is used prefer using the standard libs New function.
go/border/rpkt/rpkt.go, line 306 at r1 (raw file):
// L4 header was parsed without error, then parse payload if sp.Pld, err = rp.Payload(verify); err != nil { if xerrors.Is(err, ErrUnsupportedL4) {
if !xerrors.Is(err, ErrUn..) {return nil, err}
return will be sp, nil below.
go/lib/addr/host.go, line 60 at r1 (raw file):
var ( // ErrBadHostAddrType indicates an invalid host address type. ErrBadHostAddrType = serrors.New("unsupported host address type")
errors.New
go/lib/addr/host.go, line 62 at r1 (raw file):
ErrBadHostAddrType = serrors.New("unsupported host address type") // ErrMalformedHostAddrType indicates a malformed host address type. ErrMalformedHostAddrType = serrors.New("malformed host address type")
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @oncilla)
go/border/rpkt/l4.go, line 28 at r1 (raw file):
Previously, Oncilla wrote…
If no context is used prefer using the standard libs New function.
Done.
go/border/rpkt/rpkt.go, line 306 at r1 (raw file):
Previously, Oncilla wrote…
if !xerrors.Is(err, ErrUn..) {return nil, err}
return will be sp, nil below.
Done.
go/lib/addr/host.go, line 60 at r1 (raw file):
Previously, Oncilla wrote…
errors.New
No we should use serrors.New I fixed the doc.
go/lib/addr/host.go, line 62 at r1 (raw file):
Previously, Oncilla wrote…
ditto
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3.
Reviewable status:complete! all files reviewed, all discussions resolved
Those checks are dangerous since a refactor could easily break them.
Using xerrors.Is instead is safer against refactors.
Contributes #3042
This change is