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

_isValid check is invalid #2

Open
Diferno opened this issue Jul 14, 2017 · 2 comments
Open

_isValid check is invalid #2

Diferno opened this issue Jul 14, 2017 · 2 comments
Labels

Comments

@Diferno
Copy link

Diferno commented Jul 14, 2017

Hi!
I'm just doing an ItemSearch and turns out that no items match my search criteria.

Although the AWS Api returns:

<Request>
    <IsValid>True</IsValid>
     <ItemSearchRequest>...</ItemSearchRequest>
     <Errors>
          <Error>
               <Code>AWS.ECommerceService.NoExactMatches</Code>
               <Message>We did not find any matches for your request.</Message>
          </Error>
     </Errors>
</Request>

Piranhax tells me that the request is invalid and therefor the promise fails. Can't tell if it failed because of an error on the request or just because my search found no results.

Shouldn't it take into account the IsValid field and show the error message in case of erros and not just reject?

Thanks in advance

@raitucarp
Copy link
Member

raitucarp commented Jul 15, 2017

What is the value of TotalResults?

In their documentation, Amazon states that:

Although an IsValid value of True specifies that the request was valid and executed, it does not mean that a result was obtained. There may not have been any items that satisfied the search criteria, for example. To check for this condition, either search for the presence of an Error element, or evaluate the value of the TotalItems element. If the value is zero, there are no results to display, as shown in the following example.

http://docs.aws.amazon.com/AWSECommerceService/latest/GSG/CheckingRequestExecution.html

Should it excluded from exception or not? What do you think?

Because, exception raised when a request got non success response, or there are some errors in response. And promise will reject it.

I will investigate in detail, and consider the best solution for this.

@raitucarp raitucarp added the bug label Jul 15, 2017
@Diferno
Copy link
Author

Diferno commented Jul 17, 2017

TotalResults = 0

It was a search returning no values and was trying to handle it on the then part of the promise, but was going nuts because it's thrown to the catch.
From my point of view, the request should be invalid if the field IsValid is set to false, otherwise is valid but there can be either results to show or errors to handle (as in an empty search)

Thx in advance!

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

2 participants