Skip to content

Code changed to show correct status from postman when job does not exist#1344

Merged
kumarashit merged 1 commit intosodafoundation:masterfrom
subi9:master
May 20, 2022
Merged

Code changed to show correct status from postman when job does not exist#1344
kumarashit merged 1 commit intosodafoundation:masterfrom
subi9:master

Conversation

@subi9
Copy link
Contributor

@subi9 subi9 commented Apr 29, 2022

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
kind bug fix

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?:

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind TESTED

/kind NOT-TESTED

Test Report:

Screenshot from 2022-04-29 12-28-00
Screenshot from 2022-04-29 21-35-22
Screenshot from 2022-04-29 21-35-32
Screenshot from 2022-04-29 21-35-44

Special notes for your reviewer:

@PravinRanjan10
Copy link
Collaborator

@kumarashit please review this

@PravinRanjan10
Copy link
Collaborator

LGTM

@kumarashit
Copy link
Collaborator

Please check the CI

@PravinRanjan10
Copy link
Collaborator

PR Accepted

@subi9 subi9 force-pushed the master branch 2 times, most recently from c3b01f0 to 372a8aa Compare May 1, 2022 02:39
@codecov
Copy link

codecov bot commented May 1, 2022

Codecov Report

Merging #1344 (f2621b4) into master (4285082) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1344   +/-   ##
=======================================
  Coverage   48.12%   48.12%           
=======================================
  Files          10       10           
  Lines        1571     1571           
=======================================
  Hits          756      756           
  Misses        756      756           
  Partials       59       59           

@PravinRanjan10
Copy link
Collaborator

@kumarashit plz review

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") {
Copy link
Collaborator

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

@PravinRanjan10 PravinRanjan10 added SODACODE2022 SODACODE2022 Hackathon Label SODAMED SODACODE2022 Hackathon Medium Priority Label labels May 2, 2022
backendService_K8S = "soda.multicloud.v1.backend"
s3Service_K8S = "soda.multicloud.v1.s3"
dataflowService_K8S = "soda.multicloud.v1.dataflow"
job_not_exist = "job not exist"
Copy link
Collaborator

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.

Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Collaborator

@PravinRanjan10 PravinRanjan10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@kumarashit kumarashit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kumarashit kumarashit merged commit b1c13d8 into sodafoundation:master May 20, 2022
@subi9
Copy link
Contributor Author

subi9 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

SODACODE2022 SODACODE2022 Hackathon Label SODAMED SODACODE2022 Hackathon Medium Priority Label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants