Code changed to show correct status from postman when job does not exist#1344
Merged
kumarashit merged 1 commit intosodafoundation:masterfrom May 20, 2022
Merged
Code changed to show correct status from postman when job does not exist#1344kumarashit merged 1 commit intosodafoundation:masterfrom
kumarashit merged 1 commit intosodafoundation:masterfrom
Conversation
Collaborator
|
@kumarashit please review this |
Collaborator
|
LGTM |
Collaborator
|
Please check the CI |
Collaborator
|
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 |
Collaborator
|
@kumarashit plz review |
kumarashit
reviewed
May 2, 2022
api/pkg/dataflow/service.go
Outdated
| 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") { |
Collaborator
There was a problem hiding this comment.
Is it possible to put these strings as var and refer them here? These seems to be generic which can be referred elsewhere too
kumarashit
reviewed
May 3, 2022
api/pkg/dataflow/service.go
Outdated
| backendService_K8S = "soda.multicloud.v1.backend" | ||
| s3Service_K8S = "soda.multicloud.v1.s3" | ||
| dataflowService_K8S = "soda.multicloud.v1.dataflow" | ||
| job_not_exist = "job not exist" |
Collaborator
There was a problem hiding this comment.
nit: Maybe you can check golang variable naming conventions. It should not have underscores.
Collaborator
There was a problem hiding this comment.
@subi9 Please change,
job_not_exist to jobNotExist
Contributor
Author
There was a problem hiding this comment.
Hi Ashit/Pravin, I have changed the variable name to "jobNotExist".Please review the same.
Contributor
Author
|
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:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: