mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-09 22:32:12 +02:00
Add error handling.
This commit is contained in:
parent
c0b4d35573
commit
a588a0c82e
2 changed files with 13 additions and 1 deletions
|
@ -42,6 +42,18 @@ def get_osm(
|
|||
{"bbox": boundary_box.get_format()},
|
||||
)
|
||||
|
||||
if not content.startswith(b"<"):
|
||||
if content == (
|
||||
b"You requested too many nodes (limit is 50000). Either request a "
|
||||
b"smaller area, or use planet.osm"
|
||||
):
|
||||
raise NetworkError(
|
||||
"Cannot download data: too many nodes (limit is 50000). Try "
|
||||
"to request smaller area."
|
||||
)
|
||||
else:
|
||||
raise NetworkError("Cannot download data.")
|
||||
|
||||
with cache_file_path.open("bw+") as output_file:
|
||||
output_file.write(content)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue