Skip to content
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

Review how we handle error codes #1

Open
MSevey opened this issue Mar 22, 2021 · 4 comments
Open

Review how we handle error codes #1

MSevey opened this issue Mar 22, 2021 · 4 comments

Comments

@MSevey
Copy link
Contributor

MSevey commented Mar 22, 2021

Issue by m-cat
Friday Jul 17, 2020 at 12:02 GMT
Originally opened as NebulousLabs/go-skynet#11


We should know the StatusCodes we should receive and handle them accordingly. Something like a switch statement that handles different codes explicitly and gives a developer error if we have missed one?

Otherwise if that is over the top I think we should explicitly check for success and return an error if not so we aren't hiding any weird status codes that might create UX bugs or inconsistencies for users.

See NebulousLabs/go-skynet#10 (review)

I'm thinking we treat >= 200 and < 300 as success and anything else as unexpected and therefore an error.

@MSevey
Copy link
Contributor Author

MSevey commented Mar 22, 2021

Comment by ro-tex
Monday Aug 03, 2020 at 12:43 GMT


We need to treat 3xx according to their specification - following redirects, etc. We can choose to return them to the caller, in case the API supports that or we decide that it should support it. But we can't treat a redirect as an error, especially now that siad is using redirects in order to ensure skylinks have a trailing /.

@MSevey
Copy link
Contributor Author

MSevey commented Mar 22, 2021

Comment by m-cat
Thursday Aug 06, 2020 at 15:52 GMT


Seems like Go's http client will follow redirects automatically, so there's nothing we need to do there.

@MSevey
Copy link
Contributor Author

MSevey commented Mar 22, 2021

Comment by ro-tex
Monday Aug 17, 2020 at 14:51 GMT


In that case I'll close the issue.

@MSevey
Copy link
Contributor Author

MSevey commented Mar 22, 2021

Comment by ro-tex
Monday Aug 17, 2020 at 14:52 GMT


I misread. We don't need to do anything special for the 3xx case but we still need to do that rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant