improve stability of ctx.add_basemap() #248
Merged
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.
Fixes #247
Changed:
HTTPError
s are captured and retriedThe code in this contribution catches all
HTTPError
s and therefore makes it impossible that the code continue withNone
in thearrays
list. This used to cause varying errors related toNone
, depending on whether the first in thearrays
list wasNone
or not, or any of the others. By capturing all HTTPErrors, the code is redirected to retrying instead of that the_retryer()
function returns None. Aftermax_retries
is reached, the user now gets a informative error message. The format of the message is based on whatrequest.raise_for_status()
would return.The current code proves useful, these were the error messages during the manual tests:
HTTPError: Connection reset by peer too many times. Last message was: 502 Error: Bad Gateway for url: https://a.tile.openstreetmap.fr/hot/10/812/458.png
500 Error
(forgot to copy this one when it occurred@martinfleis could you review this PR?