This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #52
Description of the issue/feature this PR addresses
Linked issue: #51
Current behavior before PR
When a query to the JSON API for fetching data is not successful (either an error response is received or no response is received at all) then getting the value of the key
count
from the response raises an error:senaite.sync/src/senaite/sync/updatestep.py
Line 74 in bee2388
senaite.sync/src/senaite/sync/fetchstep.py
Line 122 in d029f39
Error message:
Desired behavior after PR is merged
When receiveing an error response or no response at all log the error and return without raising an exception. Note that we are logging the response error message. We can be sure that if the API response contains an error message the key
message
will exist due to: https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/exceptions.py#L11--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.