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

Errors that returned by most of functions can hide issues communicated in HTTP API responses #116

Closed
zhucebuliaolongchuan opened this issue Jun 19, 2018 · 2 comments

Comments

@zhucebuliaolongchuan
Copy link

Errors that returned by most of function are actually return the error that raised by the internal function that actually would not fail for most of the times. The http.response return value actually carry some information such as > 300 response code which absolutely indicate some problems, but the error value would be nil most of times.

For example, I try to add the same vhost for multiple times, but the function would not return any error. But the response body indicate that the http.StatusCode is >300, which is not a expected status. And most of the function has the same problem, such as add user operation. What's more, even though you use random string as username and random string as password, you can actually establish the connection and can do everything without any returned error, but obviously the function would do nothing. So to this extend, the error value that returned by most operations seems useless since they are always nil.

The current solution to make our programs that using your repo work is to capture the http status code of the http response. But it barely indicate any problem. We could not know the real reason if the program fail, since error value is always nil.

@michaelklishin
Copy link
Owner

Returning an HTTP response or status code would help in some scenarios but it would be completely useless in others. If hostname resolution or TCP connection fails, there would be no HTTP response to return.

@zhucebuliaolongchuan given that returning an HTTP response is not something I'd be interested in doing, what alternatives do we have that would make this client work better for the scenarios you've outlined? I don't see a specific proposal in this issue, only a complaint.

@michaelklishin michaelklishin changed the title Errors that returned by most of functions doesn't indicate real error Errors that returned by most of functions can hide issues communicated in HTTP API responses Feb 9, 2019
@beetahnator
Copy link
Contributor

@michaelklishin PR for catching bad credentials #145

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

3 participants