WIP feat: return response on functions #361

Closed
ankitm123 wants to merge 2 commits from ankitm123/go-sdk:sdk-347 into main
First-time contributor

This PR:

  • Creates a Response struct
  • Returns Response struct in addition to error.

Fixes #347

This PR: * Creates a Response struct * Returns Response struct in addition to error. Fixes #347
ankitm123 force-pushed sdk-347 from aa263f0475 to eb986ba05f 2020-06-07 19:40:24 +00:00 Compare
Owner

@ankitm123 you dont need to squash, its easyer to review diffs per commit - and thans for your work

@ankitm123 you dont need to squash, its easyer to review diffs per commit - and thans for your work
6543 added this to the v0.13.0 milestone 2020-06-07 21:01:29 +00:00
6543 added the
kind/breaking
kind/feature
status/wip
labels 2020-06-07 21:01:53 +00:00
6543 reviewed 2020-06-08 23:00:55 +00:00
Dismissed
@ -111,3 +117,3 @@
return nil, nil, err
}
switch resp.StatusCode {
Owner

I know this is stil WIP ...
... but I wont remove status check on the client

and on function witch use e.g. getResponse
dont return nil, nil, err -> return nil, resp, err and it should work all fine

I know this is stil WIP ... ... but I wont remove status check on the client and on function witch use e.g. getResponse dont `return nil, nil, err` -> `return nil, resp, err` and it should work all fine
Author
First-time contributor

I think the burden of checking the response status code should be with the end user, but I can return the textual representation of some of the status code (the ones in that status check), thoughts?

I think the burden of checking the response status code should be with the end user, but I can return the textual representation of some of the status code (the ones in that status check), thoughts?
Owner

I think the client should check if there was an error - since http status codes represent them

if remove this a lot of code is not gone just the user has to reimplement it elsewhere
and it is harder to use

I think the client should check if there was an error - since http status codes represent them if remove this a lot of code is not gone just the user has to reimplement it elsewhere and it is harder to use
Author
First-time contributor

I agree for 5XXs, yes, but not so sure about 4XXs (There can be cases where 4XXs are not considered errors)

I agree for 5XXs, yes, but not so sure about 4XXs (There can be cases where 4XXs are not considered errors)
Owner

thats why we will return responce too so the user still can deside what to do with it

thats why we **will** return responce **too** so the user still can deside what to do with it
Author
First-time contributor

The idiomatic way to do error checks in go, would mean that if it's an error, then people wont get it to the check for response, right?

if err != nil {
  return ...
}

//check for response if error is not present ...
The idiomatic way to do error checks in go, would mean that if it's an error, then people wont get it to the check for response, right? ``` if err != nil { return ... } //check for response if error is not present ... ```
Author
First-time contributor

So an error for 4XXs will make it a bit complicated imo.

So an error for 4XXs will make it a bit complicated imo.
Owner

If i like to get something and it return 404 its not what i wont -> error

If the user like to know that he can still check the status with this pull

If i like to get something and it return 404 its not what i wont -> error If the user like to know that he can still check the status with this pull
ankitm123 added 1 commit 2020-06-15 19:44:20 +00:00
Some checks failed
continuous-integration/drone/pr Build is failing
d5327c3b6c
refactor: modify more functions
Signed-off-by: ankitm123 <ankitmohapatra123@gmail.com>
Owner

@ankitm123 what's the matter?

@ankitm123 what's the matter?
6543 removed this from the v0.13.0 milestone 2020-09-12 04:31:31 +00:00
6543 closed this pull request 2020-09-14 02:37:34 +00:00
Some checks are pending
continuous-integration/drone/pr Build is failing
testing / testing*
Required

Pull request closed

Sign in to join this conversation.
No description provided.