-
Notifications
You must be signed in to change notification settings - Fork 78
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
[bugfix] non grpc style error parse result returns Unknown status, it should be re-parse to find inside status #1981
[bugfix] non grpc style error parse result returns Unknown status, it should be re-parse to find inside status #1981
Conversation
[CHATOPS:HELP] ChatOps commands.
|
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.
LGTM
[FOSSA] The scan result will be available at https://app.fossa.com/projects/custom%2B21465%2Fvald/refs/branch/bugfix%2Finternal-grpc%2Fnon-grpc-style-error-parsing/b4392cf584b32838a6e99d606c2e99c07949d60e |
Profile Report
|
5536ae9
to
5c027d8
Compare
Deploying with Cloudflare Pages
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1981 +/- ##
==========================================
- Coverage 29.68% 29.60% -0.08%
==========================================
Files 364 365 +1
Lines 34156 34236 +80
==========================================
- Hits 10139 10137 -2
- Misses 23602 23680 +78
- Partials 415 419 +4
... and 4 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@@ -114,6 +114,9 @@ var ( | |||
return Errorf(format, args...) | |||
} | |||
|
|||
// Join represents a function to generate multiple error when the input errors is not nil. | |||
Join = errors.Join |
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.
typecheck: Join not declared by package errors
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
Help us improve LIFT! (Sonatype LiftBot external survey)
Was this a good recommendation for you? Answering this survey will not impact your Lift settings.
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
// Is represents a function to check whether err and the target is the same or not. | ||
func Is(err, target error) bool { | ||
if target == nil || err == nil { | ||
return err == target |
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.
🚫 [golangci] reported by reviewdog 🐶
comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
} | ||
isComparable := reflect.TypeOf(target).Comparable() | ||
for { | ||
if isComparable && (err == target || |
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.
🚫 [golangci] reported by reviewdog 🐶
comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
}); ok && x.Is(target) { | ||
return true | ||
} | ||
switch x := err.(type) { |
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.
🚫 [golangci] reported by reviewdog 🐶
type switch on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
6655f6f
to
c1a0645
Compare
if err != nil { | ||
return nil | ||
} | ||
switch x := err.(type) { |
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.
🚫 [golangci] reported by reviewdog 🐶
type switch on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
internal/errors/errors.go
Outdated
return nil | ||
case 1: | ||
return errs[0] | ||
case 2: |
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.
🚫 [golangci] reported by reviewdog 🐶
mnd: Magic number: 2, in detected (gomnd)
// Unwrap represents errors.Unwrap. | ||
func Unwrap(err error) error { | ||
if err != nil { | ||
return nil |
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.
🚫 [golangci] reported by reviewdog 🐶
error is not nil (line 195) but it returns nil (nilerr)
a79c577
to
8f5c0c5
Compare
8f5c0c5
to
6fbe04b
Compare
[FOSSA] The scan result will be available at https://app.fossa.com/projects/custom%2B21465%2Fvald/refs/branch/bugfix%2Finternal-grpc%2Fnon-grpc-style-error-parsing/06ffa17c9e1b66b7210f03556ae6f249ed0a927b |
Profile Report
|
switch l := len(errs); l { | ||
case 0: | ||
return nil | ||
case 1, 2: |
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.
🚫 [golangci] reported by reviewdog 🐶
mnd: Magic number: 2, in detected (gomnd)
… should be re-parse to find inside status Signed-off-by: kpango <kpango@vdaas.org>
6fbe04b
to
f2187b0
Compare
[FOSSA] The scan result will be available at https://app.fossa.com/projects/custom%2B21465%2Fvald/refs/branch/bugfix%2Finternal-grpc%2Fnon-grpc-style-error-parsing/9676086a43def5b82b73a96999457f36c870aaf1 |
Profile Report
|
case interface{ Unwrap() error }: | ||
err = x.Unwrap() | ||
if err == nil { | ||
return isComparable && err == target || |
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.
🚫 [golangci] reported by reviewdog 🐶
comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
Could you please show me the overview your changes ( especially, the approach for resolve ) at the PR description? |
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.
Thank you, LGTM!
Description:
In the case that gRPC Status Parser returns "Unknown", we should look at the internal Error to determine the status.
During the process of modifying gRPC Status Parser, I needed an Error Join that can save gRPC Error without making it a String, so I added a Join.
Changed part of errors.Wrap to Join for LB GW only.
Related Issue:
Versions:
Checklist:
Special notes for your reviewer: