…Amazon are handled by redirecting the user to the search page and providing an error message.
Resolves #60
Description
Currently if searching Amazon fails to connect or returns a non-success http response code (such as 500), we do not handle it. This PR will catch network connection errors as well as error code responses and redirect the user to the search page and flash a message.
This solution allows any http response in the 200 range and 302, and 304. All 200's are considered successful, so we should accept them. 302 and 304 are less common, but they sometimes occur because of http caching (I think), so we should catch them too. Being more restrictive might cause good, useful responses to be lost and frustrate the user.
Type of change
New feature (non-breaking change which adds functionality)
How Has This Been Tested?
Can be tested by running rspec. New specs have been written to cover response code cases and http error cases.
Manual testing network errors:
Go to the search page.
Disconnect from the internet.
Do a search.
You will see the error message.
Manual testing http response errors:
Edit the SearchResponse#error? method to always return true.
Go to the search page and do a search.
You will see the error message.
…Amazon are handled by redirecting the user to the search page and providing an error message.
Resolves #60
Description
Currently if searching Amazon fails to connect or returns a non-success http response code (such as 500), we do not handle it. This PR will catch network connection errors as well as error code responses and redirect the user to the search page and flash a message.
This solution allows any http response in the 200 range and 302, and 304. All 200's are considered successful, so we should accept them. 302 and 304 are less common, but they sometimes occur because of http caching (I think), so we should catch them too. Being more restrictive might cause good, useful responses to be lost and frustrate the user.
Type of change
How Has This Been Tested?
Can be tested by running rspec. New specs have been written to cover response code cases and http error cases.
Manual testing network errors:
Manual testing http response errors: