Skip to content

Why EnsureSuccess #48

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

Closed
JeroenOris opened this issue May 8, 2015 · 3 comments
Closed

Why EnsureSuccess #48

JeroenOris opened this issue May 8, 2015 · 3 comments
Labels

Comments

@JeroenOris
Copy link

why is there an EnsureSuccess function added to the clients in this commit? 59fe0c6 In some servers you get an error response when no data is found (404) or a malformed request is made (403). It's not possible any more to use these services with this project. What is other people's opinion about this? Remove the ensuresuccess function?

@Yoerids
Copy link

Yoerids commented May 11, 2015

Exactly. We have the same problem. Some of our business rule validation errors return a 403 response...

@faniereynders
Copy link
Member

The reason for this is to handle the applicable response accordingly by wrapping the call in a try/catch. If the server returns any status 5XX and 4XX it suggests a server or client error respectively and this should then be handled in the appropriate catch block. This mainly prevents a whole lot of 'if' operations.

@faniereynders
Copy link
Member

Let's move any potential further discussions to #73

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

No branches or pull requests

3 participants