recurly/recurly-client-java

Descriptive ApiError for purchase preview enpoint

muratovi opened this issue · 6 comments

Not sure whether it's relevant after #55 was resolved, but if billing information has state (not configured in avalara) and zip code for state that is configured in avalara following error is thrown by API:
Screen Shot 2019-12-30 at 16 37 48

bhelx commented

I'd actually expect that to be a ValidationException and not a generic ApiError. What are the details in the error property?

I'd actually expect that to be a ValidationException and not a generic ApiError. What are the details in the error property?

It returns "Tax service currently not available, please try again later."
But in reality service is available, but provided billing information is intentionally incorrect (NY as state and NJ as zip code)

Screen Shot 2019-12-31 at 12 41 23

bhelx commented

Okay, thanks for providing the details. Let me see what is happening on the API side. I'd expect the server to be doing something different.

bhelx commented

@muratovi It appears that the API is not properly distinguishing b/w different error categories from our tax service. I'm going to file a ticket to investigate this and perhaps get a fix out. We should only be throwing that "service_not_available" error in the event that the service is actually down.

@bhelx Can you include Error object into exception message and review logic on how message and params fields are populated ?

public ApiException(String message, Error e) {
    super(message);
    this.error = e;
  }

In some exceptions only message or params field is populated, that complicates usage of API:
Screen Shot 2020-01-13 at 16 48 54

bhelx commented

I believe this has been addressed. Feel free to re-open or continue the discussion if not.