-
Notifications
You must be signed in to change notification settings - Fork 16
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
NullPointerException while getting non-existent proxy #8
Comments
While the NPE is certainly a bug, I think that throwing IOException would be a better option than returning null. toxiproxy-java is meant to be a thin client, translating the HTTP API into a Java API. Therefore error responses (like 404) should be translated into some kind of error, like Java exception. In bbc47f3 I tried to make the error handling more resilient (no more NPEs). I hope it's acceptable for you. BTW - which version of the Toxiproxy Server do you use? It's a bit strange that you don't get the correct JSON as a response for the request. |
Hi! I'm using toxiproxy 2.1.0 and I've got 404. Which means proxy was not found rather than IO problems. Having IOException may be misleading...Maybe better create method getProxyOrNull? Null is pretty valid here. Nothing found, nothing returned. |
I can agree to getProxyOrNull :) |
Steps to reproduce:
In logs:
Expected:
The text was updated successfully, but these errors were encountered: