-
Notifications
You must be signed in to change notification settings - Fork 329
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
Code changed to show correct status from postman when job does not exist #1344
Conversation
@kumarashit please review this |
LGTM |
Please check the CI |
PR Accepted |
c3b01f0
to
372a8aa
Compare
Codecov Report
@@ Coverage Diff @@
## master #1344 +/- ##
=======================================
Coverage 48.12% 48.12%
=======================================
Files 10 10
Lines 1571 1571
=======================================
Hits 756 756
Misses 756 756
Partials 59 59 |
@kumarashit plz review |
api/pkg/dataflow/service.go
Outdated
@@ -420,6 +423,11 @@ func (s *APIService) GetJob(request *restful.Request, response *restful.Response | |||
ctx := common.InitCtxWithAuthInfo(request) | |||
res, err := s.dataflowClient.GetJob(ctx, &dataflow.GetJobRequest{Id: id}) | |||
if err != nil { | |||
if strings.Contains(err.Error(), "job not exist") || strings.Contains(err.Error(), "invalid input to ObjectIdHex") { |
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.
Is it possible to put these strings as var and refer them here? These seems to be generic which can be referred elsewhere too
api/pkg/dataflow/service.go
Outdated
@@ -42,6 +45,7 @@ const ( | |||
backendService_K8S = "soda.multicloud.v1.backend" | |||
s3Service_K8S = "soda.multicloud.v1.s3" | |||
dataflowService_K8S = "soda.multicloud.v1.dataflow" | |||
job_not_exist = "job not exist" |
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.
nit: Maybe you can check golang variable naming conventions. It should not have underscores.
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.
@subi9 Please change,
job_not_exist to jobNotExist
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.
Hi Ashit/Pravin, I have changed the variable name to "jobNotExist".Please review the same.
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
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
Hi Ashit,
We can change the "job not exist" message and store it in a variable but
"invalid input to object id hex" is not generic so we can keep as it is.
Please let me know.
Thanks,
Subinoy
…On Mon, May 2, 2022 at 8:07 AM Ashit Kumar ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In api/pkg/dataflow/service.go
<#1344 (comment)>
:
> @@ -420,6 +423,11 @@ func (s *APIService) GetJob(request *restful.Request, response *restful.Response
ctx := common.InitCtxWithAuthInfo(request)
res, err := s.dataflowClient.GetJob(ctx, &dataflow.GetJobRequest{Id: id})
if err != nil {
+ if strings.Contains(err.Error(), "job not exist") || strings.Contains(err.Error(), "invalid input to ObjectIdHex") {
Is it possible to put these strings as var and refer them here? These
seems to be generic which can be referred elsewhere too
—
Reply to this email directly, view it on GitHub
<#1344 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APHP6DESFIBTVJ7TQ64FCI3VH45UZANCNFSM5UWRIVBQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
What type of PR is this?
What this PR does / why we need it:
While using postman api, when the get jobs is hit, job number which does not exist in the system throws a 500 internal server error message which is wrong. When a job does not exist in the system it will simply throw an 404 error and show message as "Job does not exist in the system"
Which issue(s) this PR fixes:
Fixes ##938
Test Report Added?:
/kind TESTED
Test Report:
Special notes for your reviewer: